def analyse_expressions(self, env):
if self.body:
- self.body.analyse_expressions(env)
+ scope = self.entry.type.scope
+ print "env", env
+ print "scope", scope
+ print scope.outer_scope
+ self.body.analyse_expressions(scope)
def generate_function_definitions(self, env, code):
if self.body:
error(pos, "'%s' is not declared" % name)
def lookup(self, name):
+ print "looking up", name, "in", self
# Look up name in this scope or an enclosing one.
# Return None if not found.
return (self.lookup_here(name)
def add_string_const(self, value):
return self.outer_scope.add_string_const(value)
+ def lookup(self, name):
+ print "*** Looking for", name, "in ClassScope", self
+ print self.entries
+ res = Scope.lookup(self, name)
+ print "got", res, res.type
+ return res
+
class PyClassScope(ClassScope):
# Namespace of a Python class.
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
entry = self.add_cfunction(base_entry.name, base_entry.type, None,
adapt(base_entry.cname), base_entry.visibility)
entry.is_inherited = 1
-
+
class PropertyScope(Scope):
# Scope holding the __get__, __set__ and __del__ methods for