metagraph-dev / mlir-graphblas

MLIR tools and dialect for GraphBLAS
https://mlir-graphblas.readthedocs.io/en/latest/
Apache License 2.0
15 stars 6 forks source link

IR builder to raise exception when using variables outside of valid scope #255

Open paul-tqh-nguyen opened 2 years ago

paul-tqh-nguyen commented 2 years ago
with irb.for_loop(0, num_nodes) as node_for_vars:
    node_idx = node_for_vars.iter_var_index

When using node_for_vars.* or node_idx outside of the with block, we should get an exception.

This checking should happen in the __str__ or assign methods.

We shouldn't get an exception for node_for_vars.returned_variable.

This should also apply to any variables initialized within the with body.

We should investigate if this idea might apply to the IR builder's scf.while functionality.