# name string
# entry Symtab.Entry
child_attrs = []
-
+
+ def generate_function_definitions(self, env, code):
+ self.entry.generate_function_definitions(env, code)
class DecoratorNode(Node):
# A decorator
self.expr.generate_disposal_code(code)
self.expr.free_temps(code)
+ def generate_function_definitions(self, env, code):
+ self.expr.generate_function_definitions(env, code)
+
def annotate(self, code):
self.expr.annotate(code)
def generate_assignment_code(self, code):
self.lhs.generate_assignment_code(self.rhs, code)
+ def generate_function_definitions(self, env, code):
+ self.rhs.generate_function_definitions(env, code)
+
def annotate(self, code):
self.lhs.annotate(code)
self.rhs.annotate(code)
self.rhs.generate_disposal_code(code)
self.rhs.free_temps(code)
+ def generate_function_definitions(self, env, code):
+ self.rhs.generate_function_definitions(env, code)
+
def annotate(self, code):
for i in range(len(self.lhs_list)):
lhs = self.lhs_list[i].annotate(code)
for stat in self.stats:
stat.generate_assignment_code(code)
+ def generate_function_definitions(self, env, code):
+ for stat in self.stats:
+ stat.generate_function_definitions(env, code)
+
def annotate(self, code):
for stat in self.stats:
stat.annotate(code)
class InPlaceAssignmentNode(AssignmentNode):
- # An in place arithmatic operand:
+ # An in place arithmetic operand:
#
# a += b
# a -= b
self.arg_tuple.generate_disposal_code(code)
self.arg_tuple.free_temps(code)
+ def generate_function_definitions(self, env, code):
+ for item in self.arg_tuple:
+ item.generate_function_definitions(env, code)
+
def annotate(self, code):
self.arg_tuple.annotate(code)
for cname, type in code.funcstate.temps_holding_reference():
code.put_decref_clear(cname, type)
code.put_goto(code.return_label)
+
+ def generate_function_definitions(self, env, code):
+ if self.value is not None:
+ self.value.generate_function_definitions(env, code)
def annotate(self, code):
if self.value:
code.putln(
code.error_goto(self.pos))
+ def generate_function_definitions(self, env, code):
+ if self.exc_type is not None:
+ self.exc_type.generate_function_definitions(env, code)
+ if self.exc_value is not None:
+ self.exc_value.generate_function_definitions(env, code)
+ if self.exc_tb is not None:
+ self.exc_tb.generate_function_definitions(env, code)
+
def annotate(self, code):
if self.exc_type:
self.exc_type.annotate(code)
self.cond.free_temps(code)
code.putln("#endif")
+ def generate_function_definitions(self, env, code):
+ self.cond.generate_function_definitions(env, code)
+ if self.value is not None:
+ self.value.generate_function_definitions(env, code)
+
def annotate(self, code):
self.cond.annotate(code)
if self.value:
self.else_clause.generate_execution_code(code)
code.putln("}")
code.put_label(end_label)
+
+ def generate_function_definitions(self, env, code):
+ for clause in self.if_clauses:
+ clause.generate_function_definitions(env, code)
+ if self.else_clause is not None:
+ self.else_clause.generate_function_definitions(env, code)
def annotate(self, code):
for if_clause in self.if_clauses:
code.put_goto(end_label)
code.putln("}")
+ def generate_function_definitions(self, env, code):
+ self.condition.generate_function_definitions(env, code)
+ self.body.generate_function_definitions(env, code)
+
def annotate(self, code):
self.condition.annotate(code)
self.body.annotate(code)
code.putln("case %s:" % cond.result())
self.body.generate_execution_code(code)
code.putln("break;")
+
+ def generate_function_definitions(self, env, code):
+ for cond in self.conditions:
+ cond.generate_function_definitions(env, code)
+ self.body.generate_function_definitions(env, code)
def annotate(self, code):
for cond in self.conditions:
code.putln("break;")
code.putln("}")
+ def generate_function_definitions(self, env, code):
+ self.test.generate_function_definitions(env, code)
+ for case in self.cases:
+ case.generate_function_definitions(env, code)
+ if self.else_clause is not None:
+ self.else_clause.generate_function_definitions(env, code)
+
def annotate(self, code):
self.test.annotate(code)
for case in self.cases:
code.putln("}")
code.put_label(break_label)
+ def generate_function_definitions(self, env, code):
+ self.condition.generate_function_definitions(env, code)
+ self.body.generate_function_definitions(env, code)
+ if self.else_clause is not None:
+ self.else_clause.generate_function_definitions(env, code)
+
def annotate(self, code):
self.condition.annotate(code)
self.body.annotate(code)
self.iterator.generate_disposal_code(code)
self.iterator.free_temps(code)
+ def generate_function_definitions(self, env, code):
+ self.target.generate_function_definitions(env, code)
+ self.iterator.generate_function_definitions(env, code)
+ self.body.generate_function_definitions(env, code)
+ if self.else_clause is not None:
+ self.else_clause.generate_function_definitions(env, code)
+
def annotate(self, code):
self.target.annotate(code)
self.iterator.annotate(code)
'>=': ("", "--"),
'>' : ("-1", "--")
}
+
+ def generate_function_definitions(self, env, code):
+ self.target.generate_function_definitions(env, code)
+ self.bound1.generate_function_definitions(env, code)
+ self.bound2.generate_function_definitions(env, code)
+ if self.step is not None:
+ self.step.generate_function_definitions(env, code)
+ self.body.generate_function_definitions(env, code)
+ if self.else_clause is not None:
+ self.else_clause.generate_function_definitions(env, code)
def annotate(self, code):
self.target.annotate(code)
self.bound1.annotate(code)
self.bound2.annotate(code)
if self.step:
- self.bound2.annotate(code)
+ self.step.annotate(code)
self.body.annotate(code)
if self.else_clause:
self.else_clause.annotate(code)
code.continue_label = old_continue_label
code.error_label = old_error_label
+ def generate_function_definitions(self, env, code):
+ self.body.generate_function_definitions(env, code)
+ for except_clause in self.except_clauses:
+ except_clause.generate_function_definitions(env, code)
+ if self.else_clause is not None:
+ self.else_clause.generate_function_definitions(env, code)
+
def annotate(self, code):
self.body.annotate(code)
for except_node in self.except_clauses:
code.putln(
"}")
+ def generate_function_definitions(self, env, code):
+ if self.target is not None:
+ self.target.generate_function_definitions(env, code)
+ self.body.generate_function_definitions(env, code)
+
def annotate(self, code):
if self.pattern:
self.pattern.annotate(code)
code.putln(
"}")
+ def generate_function_definitions(self, env, code):
+ self.body.generate_function_definitions(env, code)
+ self.finally_clause.generate_function_definitions(env, code)
+
def put_error_catcher(self, code, error_label, i, catch_label, temps_to_clean_up):
code.globalstate.use_utility_code(restore_exception_utility_code)
code.putln(