In this case, `i` will not created in FunctionScope.
We don't collect `i` by not calling generic_visit.
"""[ i for i in range(10) ]
In this case, `i` will not created in FunctionScope.
We don't collect `i` by not calling generic_visit.
"""
pass
defvisit_DictComp(self,node):
""" the same as ListComp.
"""
"""the same as ListComp."""
pass
defvisit_Name(self,node):
...
...
@@ -1212,62 +1280,86 @@ class FunctionNameLivenessAnalysis(gast.NodeVisitor):
self._current_name_scope().w_vars.add(node.id)
defvisit_FunctionDef(self,node):
defpre_func():
self._current_name_scope().args|=set(
self._get_argument_names(node))
self._get_argument_names(node)
)
defpost_func():
""" NOTE: why we need merge w_vars and push_pop_vars here ?
because we do ifelse_transformer after loop_transformer. Loops will changed into functioons. but we know this function will be called in if. so we add w_vars to father function scope.
"""NOTE: why we need merge w_vars and push_pop_vars here ?
because we do ifelse_transformer after loop_transformer. Loops will changed into functioons. but we know this function will be called in if. so we add w_vars to father function scope.