Commit ad9a2205 authored by Craig Citro's avatar Craig Citro

initalized -> initialized

parent 9ea6a398
...@@ -1151,7 +1151,7 @@ class NameNode(AtomicExprNode): ...@@ -1151,7 +1151,7 @@ class NameNode(AtomicExprNode):
else: else:
type = py_object_type type = py_object_type
self.entry = env.declare_var(self.name, type, self.pos) 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') env.control_flow.set_state(self.pos, (self.name, 'source'), 'assignment')
if self.entry.is_declared_generic: if self.entry.is_declared_generic:
self.result_ctype = py_object_type self.result_ctype = py_object_type
...@@ -1294,13 +1294,13 @@ class NameNode(AtomicExprNode): ...@@ -1294,13 +1294,13 @@ class NameNode(AtomicExprNode):
elif entry.is_local and False: elif entry.is_local and False:
# control flow not good enough yet # 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: if assigned is False:
error(self.pos, "local variable '%s' referenced before assignment" % entry.name) error(self.pos, "local variable '%s' referenced before assignment" % entry.name)
elif not Options.init_local_none and assigned is None: elif not Options.init_local_none and assigned is None:
code.putln('if (%s == 0) { PyErr_SetString(PyExc_UnboundLocalError, "%s"); %s }' % code.putln('if (%s == 0) { PyErr_SetString(PyExc_UnboundLocalError, "%s"); %s }' %
(entry.cname, entry.name, code.error_goto(self.pos))) (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): def generate_assignment_code(self, rhs, code):
#print "NameNode.generate_assignment_code:", self.name ### #print "NameNode.generate_assignment_code:", self.name ###
...@@ -1364,10 +1364,10 @@ class NameNode(AtomicExprNode): ...@@ -1364,10 +1364,10 @@ class NameNode(AtomicExprNode):
code.put_gotref(self.py_result()) code.put_gotref(self.py_result())
if self.use_managed_ref and not self.lhs_of_first_assignment: if self.use_managed_ref and not self.lhs_of_first_assignment:
if entry.is_local and not Options.init_local_none: if entry.is_local and not Options.init_local_none:
initalized = entry.scope.control_flow.get_state((entry.name, 'initalized'), self.pos) initialized = entry.scope.control_flow.get_state((entry.name, 'initialized'), self.pos)
if initalized is True: if initialized is True:
code.put_decref(self.result(), self.ctype()) code.put_decref(self.result(), self.ctype())
elif initalized is None: elif initialized is None:
code.put_xdecref(self.result(), self.ctype()) code.put_xdecref(self.result(), self.ctype())
else: else:
code.put_decref(self.result(), self.ctype()) code.put_decref(self.result(), self.ctype())
......
...@@ -1229,7 +1229,7 @@ class FuncDefNode(StatNode, BlockNode): ...@@ -1229,7 +1229,7 @@ class FuncDefNode(StatNode, BlockNode):
code.put_label(code.return_from_error_cleanup_label) code.put_label(code.return_from_error_cleanup_label)
if not Options.init_local_none: if not Options.init_local_none:
for entry in lenv.var_entries: 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 entry.xdecref_cleanup = 1
for entry in lenv.var_entries: for entry in lenv.var_entries:
...@@ -1875,7 +1875,7 @@ class DefNode(FuncDefNode): ...@@ -1875,7 +1875,7 @@ class DefNode(FuncDefNode):
error(arg.pos, "Missing argument name") error(arg.pos, "Missing argument name")
else: else:
env.control_flow.set_state((), (arg.name, 'source'), 'arg') 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: if arg.needs_conversion:
arg.entry = env.declare_var(arg.name, arg.type, arg.pos) arg.entry = env.declare_var(arg.name, arg.type, arg.pos)
if arg.type.is_pyobject: if arg.type.is_pyobject:
...@@ -1901,7 +1901,7 @@ class DefNode(FuncDefNode): ...@@ -1901,7 +1901,7 @@ class DefNode(FuncDefNode):
entry.init_to_none = 0 entry.init_to_none = 0
entry.xdecref_cleanup = 1 entry.xdecref_cleanup = 1
arg.entry = entry 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): def analyse_expressions(self, env):
self.local_scope.directives = env.directives self.local_scope.directives = env.directives
......
...@@ -428,7 +428,7 @@ class Scope(object): ...@@ -428,7 +428,7 @@ class Scope(object):
cname = self.mangle(Naming.var_prefix, name) cname = self.mangle(Naming.var_prefix, name)
entry = self.declare(name, cname, type, pos, visibility) entry = self.declare(name, cname, type, pos, visibility)
entry.is_variable = 1 entry.is_variable = 1
self.control_flow.set_state((), (name, 'initalized'), False) self.control_flow.set_state((), (name, 'initialized'), False)
return entry return entry
def declare_builtin(self, name, pos): def declare_builtin(self, name, pos):
......
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