Commit 0a93ccb4 authored by Vitja Makarov's avatar Vitja Makarov

CF: fix locals_expressions_T430 issue

parent 42fa1f43
...@@ -169,7 +169,8 @@ class ControlFlow(object): ...@@ -169,7 +169,8 @@ class ControlFlow(object):
if self.block and self.is_tracked(entry): if self.block and self.is_tracked(entry):
self.block.stats.append(NameReference(node, entry)) self.block.stats.append(NameReference(node, entry))
# Local variable is definitely bound after this reference # Local variable is definitely bound after this reference
self.block.bounded.add(entry) if not node.allow_null:
self.block.bounded.add(entry)
self.entries.add(entry) self.entries.add(entry)
def normalize(self): def normalize(self):
...@@ -402,9 +403,11 @@ def check_definitions(flow, compiler_directives): ...@@ -402,9 +403,11 @@ def check_definitions(flow, compiler_directives):
references[stat.node] = stat.entry references[stat.node] = stat.entry
stat.entry.cf_references.append(stat) stat.entry.cf_references.append(stat)
stat.node.cf_state.update(state[stat.entry]) stat.node.cf_state.update(state[stat.entry])
state[stat.entry].discard(Uninitialized) if not stat.node.allow_null:
state[stat.entry].discard(Uninitialized)
for assmt in state[stat.entry]: for assmt in state[stat.entry]:
assmt.refs.add(stat) if assmt is not Uninitialized:
assmt.refs.add(stat)
# Check variable usage # Check variable usage
warn_maybe_uninitialized = compiler_directives['warn.maybe_uninitialized'] warn_maybe_uninitialized = compiler_directives['warn.maybe_uninitialized']
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment