Commit c4043e82 authored by tom@tom's avatar tom@tom

partial code for execution in classes

parent a1e80790
...@@ -1370,8 +1370,9 @@ class CClassDefNode(StatNode): ...@@ -1370,8 +1370,9 @@ class CClassDefNode(StatNode):
env.allocate_vtable_names(self.entry) env.allocate_vtable_names(self.entry)
def analyse_expressions(self, env): def analyse_expressions(self, env):
scope = self.entry.type.scope
if self.body: if self.body:
self.body.analyse_expressions(env) self.body.analyse_expressions(scope)
def generate_function_definitions(self, env, code): def generate_function_definitions(self, env, code):
if self.body: if self.body:
......
...@@ -1227,8 +1227,6 @@ def p_statement(s, level, cdef_flag = 0, visibility = 'private'): ...@@ -1227,8 +1227,6 @@ def p_statement(s, level, cdef_flag = 0, visibility = 'private'):
if level in ('c_class', 'c_class_pxd'): if level in ('c_class', 'c_class_pxd'):
if s.sy == 'pass': if s.sy == 'pass':
return p_pass_statement(s, with_newline = 1) return p_pass_statement(s, with_newline = 1)
else:
s.error("Executable statement not allowed here")
if s.sy == 'if': if s.sy == 'if':
return p_if_statement(s) return p_if_statement(s)
elif s.sy == 'while': elif s.sy == 'while':
......
...@@ -1088,7 +1088,7 @@ class CClassScope(ClassScope): ...@@ -1088,7 +1088,7 @@ class CClassScope(ClassScope):
if name in ('__eq__', '__ne__', '__lt__', '__gt__', '__le__', '__ge__'): if name in ('__eq__', '__ne__', '__lt__', '__gt__', '__le__', '__ge__'):
error(pos, "Special method %s must be implemented via __richcmp__" error(pos, "Special method %s must be implemented via __richcmp__"
% name) % name)
entry = self.declare(name, name, py_object_type, pos) entry = self.declare_var(name, py_object_type, pos)
special_sig = get_special_method_signature(name) special_sig = get_special_method_signature(name)
if special_sig: if special_sig:
# Special methods get put in the method table with a particular # Special methods get put in the method table with a particular
......
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