Visitar URL original
Replace `ir::BlockIdx::NULL` with `Option<ir::BlockIdx>` · Issue #7221 · RustPython/RustPython · GitHub
Skip to content

Replace ir::BlockIdx::NULL with Option<ir::BlockIdx> #7221

Description

@ShaharNaveh

Summary

We are using a hack for representing a null block index by doing:

impl BlockIdx {
pub const NULL: Self = Self::new(u32::MAX);

I think it would be better to remove this hack and using a proper Option<BlockIdx> for representing Some(BlockIdx) or a None it would ensure a proper care for a None/Some cases instead of using an if condition (which is more error prone) like:

if target == BlockIdx::NULL {
  ...
} else {
  ...
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions