partial code for execution in classes
authortom@tom <none@none>
Tue, 18 Sep 2007 17:43:44 +0000 (19:43 +0200)
committertom@tom <none@none>
Tue, 18 Sep 2007 17:43:44 +0000 (19:43 +0200)
Cython/Compiler/Nodes.py
Cython/Compiler/Parsing.py
Cython/Compiler/Symtab.py

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