# HG changeset patch # User Paul Boddie # Date 1341094190 -7200 # Node ID 3b6aafa2ca3341b03b9ba5ed4ef7844d3eb00586 # Parent 3999693d61c6f32d464ae4570c40bb773d6deab0 Added support for value assignments in general attribute name declarations. Changed the handling of globals in functions to use general attribute name declarations (the assertion of a name being used in isolation) instead of attribute usage observations (where combinations of names are used to deduce more specific types). diff -r 3999693d61c6 -r 3b6aafa2ca33 micropython/__init__.py --- a/micropython/__init__.py Sat Jun 30 21:18:06 2012 +0200 +++ b/micropython/__init__.py Sun Jul 01 00:09:50 2012 +0200 @@ -534,6 +534,8 @@ self.name_references[from_name] = set() attrnames = ObjectSet([name]) + if value is not None: + attrnames[name].add(value) usage = (attrnames,) self.name_references[from_name].add((None, None, usage)) diff -r 3999693d61c6 -r 3b6aafa2ca33 micropython/data.py --- a/micropython/data.py Sat Jun 30 21:18:06 2012 +0200 +++ b/micropython/data.py Sun Jul 01 00:09:50 2012 +0200 @@ -613,10 +613,10 @@ users = self.attribute_users[-1] - # If no users are defined for the name, provide the current namespace. + # If no users are defined for the name, it cannot be handled. if not users.has_key(name): - self._define_attribute_user_for_name(self.astnode, name) + return [] # Add the usage to all current users. diff -r 3999693d61c6 -r 3b6aafa2ca33 micropython/inspect.py --- a/micropython/inspect.py Sat Jun 30 21:18:06 2012 +0200 +++ b/micropython/inspect.py Sun Jul 01 00:09:50 2012 +0200 @@ -603,9 +603,7 @@ # independently of the namespace), or access via a module global within # a function. - if expr.parent is self.get_namespace() and not self.get_namespace() is self or \ - expr.parent is self and self.in_function: - + if expr.parent is self.get_namespace() and not self.get_namespace() is self: self.define_attribute_accessor(expr.name, attrname, node, value) else: self.use_name(attrname, node.expr, value, ns=expr.parent)