1.1 --- a/micropython/ast.py Sun Apr 06 02:53:43 2008 +0200
1.2 +++ b/micropython/ast.py Sun Apr 06 03:04:36 2008 +0200
1.3 @@ -240,7 +240,8 @@
1.4 # Where the last operation involves the special 'self' name, check to
1.5 # see if the attribute is acceptably positioned.
1.6
1.7 - elif self.unit.is_method() and isinstance(last, LoadName) and \
1.8 + elif isinstance(self.unit, micropython.inspect.Function) and \
1.9 + self.unit.is_method() and isinstance(last, LoadName) and \
1.10 last.attr.name == "self" and not self.unit.is_relocated(attrname):
1.11
1.12 attr = self.unit.parent.all_attributes()[attrname]
1.13 @@ -488,7 +489,7 @@
1.14 """
1.15
1.16 if self._should_optimise_constant_storage() and cls in (StoreAttr, StoreName) and \
1.17 - self._have_constant_input(n) and self._have_constant_input(n-1):
1.18 + self._have_constant_input(n) and (n == 0 or self._have_constant_input(n-1)):
1.19 self.remove_ops(n+1)
1.20 return 1
1.21 else: