for item in self.items:
item.analyse_declarations(env, self.entry)
- def analyse_expressions(self, env):
- if self.visibility == 'public':
- self.temp = env.allocate_temp_pyobject()
- env.release_temp(self.temp)
-
def generate_execution_code(self, code):
if self.visibility == 'public':
+ temp = code.funcstate.allocate_temp(PyrexTypes.py_object_type, manage_ref=True)
for item in self.entry.enum_values:
code.putln("%s = PyInt_FromLong(%s); %s" % (
- self.temp,
+ temp,
item.cname,
- code.error_goto_if_null(self.temp, item.pos)))
- code.put_gotref(self.temp)
+ code.error_goto_if_null(temp, item.pos)))
++ code.put_gotref(temp)
code.putln('if (__Pyx_SetAttrString(%s, "%s", %s) < 0) %s' % (
Naming.module_cname,
item.name,
- self.temp,
+ temp,
code.error_goto(item.pos)))
- code.putln("%s = 0;" % temp)
- code.put_decref_clear(self.temp, PyrexTypes.py_object_type)
++ code.put_decref_clear(temp, PyrexTypes.py_object_type)
+ code.funcstate.release_temp(temp)
class CEnumDefItemNode(StatNode):
def analyse_declarations(self, env):
entry = env.declare_property(self.name, self.doc, self.pos)
if entry:
- if self.doc and Options.docstrings:
- doc_entry = env.get_string_const(
- self.doc, identifier = False)
- entry.doc_cname = doc_entry.cname
+ entry.scope.directives = env.directives
self.body.analyse_declarations(entry.scope)
def analyse_expressions(self, env):