else:
type = py_object_type
self.entry = env.declare_var(self.name, type, self.pos)
- env.control_flow.set_state(self.pos, (self.name, 'initalized'), True)
+ env.control_flow.set_state(self.pos, (self.name, 'initialized'), True)
env.control_flow.set_state(self.pos, (self.name, 'source'), 'assignment')
if self.entry.is_declared_generic:
self.result_ctype = py_object_type
elif entry.is_local and False:
# control flow not good enough yet
- assigned = entry.scope.control_flow.get_state((entry.name, 'initalized'), self.pos)
+ assigned = entry.scope.control_flow.get_state((entry.name, 'initialized'), self.pos)
if assigned is False:
error(self.pos, "local variable '%s' referenced before assignment" % entry.name)
elif not Options.init_local_none and assigned is None:
code.putln('if (%s == 0) { PyErr_SetString(PyExc_UnboundLocalError, "%s"); %s }' %
(entry.cname, entry.name, code.error_goto(self.pos)))
- entry.scope.control_flow.set_state(self.pos, (entry.name, 'initalized'), True)
+ entry.scope.control_flow.set_state(self.pos, (entry.name, 'initialized'), True)
def generate_assignment_code(self, rhs, code):
#print "NameNode.generate_assignment_code:", self.name ###
code.put_gotref(self.py_result())
if self.use_managed_ref and not self.lhs_of_first_assignment:
if entry.is_local and not Options.init_local_none:
- initalized = entry.scope.control_flow.get_state((entry.name, 'initalized'), self.pos)
- if initalized is True:
+ initialized = entry.scope.control_flow.get_state((entry.name, 'initialized'), self.pos)
+ if initialized is True:
code.put_decref(self.result(), self.ctype())
- elif initalized is None:
+ elif initialized is None:
code.put_xdecref(self.result(), self.ctype())
else:
code.put_decref(self.result(), self.ctype())
code.put_label(code.return_from_error_cleanup_label)
if not Options.init_local_none:
for entry in lenv.var_entries:
- if lenv.control_flow.get_state((entry.name, 'initalized')) is not True:
+ if lenv.control_flow.get_state((entry.name, 'initialized')) is not True:
entry.xdecref_cleanup = 1
for entry in lenv.var_entries:
error(arg.pos, "Missing argument name")
else:
env.control_flow.set_state((), (arg.name, 'source'), 'arg')
- env.control_flow.set_state((), (arg.name, 'initalized'), True)
+ env.control_flow.set_state((), (arg.name, 'initialized'), True)
if arg.needs_conversion:
arg.entry = env.declare_var(arg.name, arg.type, arg.pos)
if arg.type.is_pyobject:
entry.init_to_none = 0
entry.xdecref_cleanup = 1
arg.entry = entry
- env.control_flow.set_state((), (arg.name, 'initalized'), True)
+ env.control_flow.set_state((), (arg.name, 'initialized'), True)
def analyse_expressions(self, env):
self.local_scope.directives = env.directives
cname = self.mangle(Naming.var_prefix, name)
entry = self.declare(name, cname, type, pos, visibility)
entry.is_variable = 1
- self.control_flow.set_state((), (name, 'initalized'), False)
+ self.control_flow.set_state((), (name, 'initialized'), False)
return entry
def declare_builtin(self, name, pos):