2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-20 00:46:30 +08:00

LocalAccessValidator: fix validation of closures with no outer variables.

This commit is contained in:
whitequark 2015-07-21 13:16:18 +03:00
parent 6f11fa6bb1
commit e299801c0f

View File

@ -99,12 +99,14 @@ class LocalAccessValidator:
if isinstance(insn, ir.Closure):
env = insn.environment()
for var_name in block_state[env]:
if not block_state[env][var_name]:
# A closure would capture this variable while it is not always
# initialized. Note that this check is transitive.
self._uninitialized_access(insn, var_name,
pred_at_fault(env, var_name))
# Make sure this environment has any interesting variables.
if env in block_state:
for var_name in block_state[env]:
if not block_state[env][var_name]:
# A closure would capture this variable while it is not always
# initialized. Note that this check is transitive.
self._uninitialized_access(insn, var_name,
pred_at_fault(env, var_name))
# Save the state.
state[block] = block_state