# HG changeset patch # User Paul Boddie # Date 1265508159 -3600 # Node ID a72712268c10791f5913cd8e730129987a474e75 # Parent c4a46d7fb328c18bd918a688838c2fb847d8fe7c Made attribute deletion usage cause a warning during inspection, not an error, so that inspection of the test program may be performed. Added an optimisation test around guard generation for name assignments. Fixed attribute usage merging to permit the recording of isolated pockets of attribute usage that are not propagated further in a program unit. diff -r c4a46d7fb328 -r a72712268c10 micropython/ast.py --- a/micropython/ast.py Sun Feb 07 02:02:15 2010 +0100 +++ b/micropython/ast.py Sun Feb 07 03:02:39 2010 +0100 @@ -509,7 +509,8 @@ # Add any attribute usage guards. - self._generateGuards(node) + if self.optimiser.should_optimise_accesses_by_attribute_usage() and hasattr(node, "_attrnames"): + self._generateGuards(node) visitAssTuple = visitAssList diff -r c4a46d7fb328 -r a72712268c10 micropython/data.py --- a/micropython/data.py Sun Feb 07 02:02:15 2010 +0100 +++ b/micropython/data.py Sun Feb 07 03:02:39 2010 +0100 @@ -398,7 +398,11 @@ for defs in shelved_defs: for name, attrnames in defs.items(): - if attrnames.issuperset(active[name]): + + # Check for isolated pockets of attribute usage as well as more + # specific usage. + + if not active.has_key(name) or attrnames.issuperset(active[name]): self.all_attributes_used.append(attrnames) # Program data structures. There are two separate kinds of structures: those diff -r c4a46d7fb328 -r a72712268c10 micropython/inspect.py --- a/micropython/inspect.py Sun Feb 07 02:02:15 2010 +0100 +++ b/micropython/inspect.py Sun Feb 07 03:02:39 2010 +0100 @@ -512,7 +512,8 @@ def visitAssName(self, node): if hasattr(node, "flags") and node.flags == "OP_DELETE": - raise InspectError(self.full_name(), node, "Deletion of attribute %r is not supported." % node.name) + print "Warning: deletion of attribute %r in %r is not supported." % (node.name, self.full_name()) + #raise InspectError(self.full_name(), node, "Deletion of attribute %r is not supported." % node.name) self.store(node.name, self.expr) self.define_attribute_user(node)