Commit d1d79cda authored by Dag Sverre Seljebotn's avatar Dag Sverre Seljebotn

Initialize unassigned node child attributes to None, clean up ExprNode

parent c5d8303c
......@@ -168,16 +168,9 @@ class ExprNode(Node):
saved_subexpr_nodes = None
is_temp = 0
def get_child_attrs(self): return self.subexprs
child_attrs = property(fget=get_child_attrs)
def get_child_attrs(self):
"""Automatically provide the contents of subexprs as children, unless child_attr
has been declared. See Nodes.Node.get_child_accessors."""
if self.child_attrs is not None:
return self.child_attrs
elif self.subexprs is not None:
return self.subexprs
child_attrs = property(fget=get_child_attrs)
def not_implemented(self, method_name):
print_call_chain(method_name, "not implemented") ###
......@@ -3289,6 +3282,8 @@ class CondExprNode(ExprNode):
# false_val ExprNode
temp_bool = None
true_val = None
false_val = None
subexprs = ['test', 'true_val', 'false_val']
......
......@@ -2217,6 +2217,7 @@ class CascadedAssignmentNode(AssignmentNode):
# coerced_rhs_list [ExprNode] RHS coerced to type of each LHS
child_attrs = ["lhs_list", "rhs", "coerced_rhs_list"]
coerced_rhs_list = None
def analyse_declarations(self, env):
for lhs in self.lhs_list:
......@@ -2353,6 +2354,7 @@ class InPlaceAssignmentNode(AssignmentNode):
# (it must be a NameNode, AttributeNode, or IndexNode).
child_attrs = ["lhs", "rhs", "dup"]
dup = None
def analyse_declarations(self, env):
self.lhs.analyse_target_declaration(env)
......@@ -2987,6 +2989,7 @@ class ForInStatNode(LoopNode, StatNode):
# item NextNode used internally
child_attrs = ["target", "iterator", "body", "else_clause", "item"]
item = None
def analyse_declarations(self, env):
self.target.analyse_target_declaration(env)
......@@ -3103,7 +3106,7 @@ class ForFromStatNode(LoopNode, StatNode):
# is_py_target bool
# loopvar_name string
# py_loopvar_node PyTempNode or None
child_attrs = ["target", "bound1", "bound2", "step", "body", "else_clause", "py_loopvar_node"]
child_attrs = ["target", "bound1", "bound2", "step", "body", "else_clause"]
def analyse_declarations(self, env):
self.target.analyse_target_declaration(env)
......@@ -3317,6 +3320,7 @@ class ExceptClauseNode(Node):
# exc_vars (string * 3) local exception variables
child_attrs = ["pattern", "target", "body", "exc_value"]
exc_value = None
def analyse_declarations(self, env):
if self.target:
......
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