1.1 --- a/docs/optimisations.txt Sat Oct 31 23:00:22 2009 +0100
1.2 +++ b/docs/optimisations.txt Tue Oct 27 00:23:28 2009 +0100
1.3 @@ -224,7 +224,16 @@
1.4 the earliest opportunity and then specialise the attribute accesses, perhaps
1.5 also invocations, in the generated code. AttributeError occurrences would need
1.6 to be considered, however, potentially disqualifying certain attributes from
1.7 -any optimisations, and control flow would also need to be considered.
1.8 +any optimisations, and control flow would also need to be considered. The
1.9 +result would resemble the following:
1.10 +
1.11 + def f(x, y):
1.12 + if not isinstance(x, C):
1.13 + raise TypeError
1.14 + x.method(y)
1.15 + if x.something:
1.16 + ...
1.17 + return x.attr
1.18
1.19 Implemented Optimisation Types
1.20 ==============================
2.1 --- a/micropython/ast.py Sat Oct 31 23:00:22 2009 +0100
2.2 +++ b/micropython/ast.py Tue Oct 27 00:23:28 2009 +0100
2.3 @@ -501,6 +501,9 @@
2.4
2.5 "Assign the assignment expression to the recipient 'node'."
2.6
2.7 + if node.flags == "OP_DELETE":
2.8 + raise TranslationNotImplementedError(self.module.full_name(), node, "AssName(OP_DELETE)")
2.9 +
2.10 self._visitName(node, self.name_store_instructions)
2.11 self.set_source()
2.12
3.1 --- a/micropython/inspect.py Sat Oct 31 23:00:22 2009 +0100
3.2 +++ b/micropython/inspect.py Tue Oct 27 00:23:28 2009 +0100
3.3 @@ -467,6 +467,9 @@
3.4 return None
3.5
3.6 def visitAssName(self, node):
3.7 + if node.flags == "OP_DELETE":
3.8 + raise InspectError(self.full_name(), node, "Deletion of attribute %r is not supported." % node.name)
3.9 +
3.10 self.store(node.name, self.expr)
3.11 self.reset_attributes(node.name)
3.12 self.use_name(node.name)
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/tests/failure/delete_name.py Tue Oct 27 00:23:28 2009 +0100
4.3 @@ -0,0 +1,6 @@
4.4 +#!/usr/bin/env python
4.5 +
4.6 +a = 123
4.7 +del a
4.8 +
4.9 +# vim: tabstop=4 expandtab shiftwidth=4