# HG changeset patch # User Paul Boddie # Date 1207443876 -7200 # Node ID 0ed30aeb2ef92a70830b17ad7f3a02d67b26acc7 # Parent 8b8bb2f70246cdd4682aa674b8651477941c5d08 Fixed "self" optimisation suitability test. Fixed constant storage suitability detection. diff -r 8b8bb2f70246 -r 0ed30aeb2ef9 lib/builtins.py --- a/lib/builtins.py Sun Apr 06 02:53:43 2008 +0200 +++ b/lib/builtins.py Sun Apr 06 03:04:36 2008 +0200 @@ -271,8 +271,8 @@ True = bool() False = bool() -None = none() -Ellipsis = ellipsis() +None = NoneType() +Ellipsis = EllipsisType() NotImplemented = NotImplementedType() # General functions. diff -r 8b8bb2f70246 -r 0ed30aeb2ef9 micropython/ast.py --- a/micropython/ast.py Sun Apr 06 02:53:43 2008 +0200 +++ b/micropython/ast.py Sun Apr 06 03:04:36 2008 +0200 @@ -240,7 +240,8 @@ # Where the last operation involves the special 'self' name, check to # see if the attribute is acceptably positioned. - elif self.unit.is_method() and isinstance(last, LoadName) and \ + elif isinstance(self.unit, micropython.inspect.Function) and \ + self.unit.is_method() and isinstance(last, LoadName) and \ last.attr.name == "self" and not self.unit.is_relocated(attrname): attr = self.unit.parent.all_attributes()[attrname] @@ -488,7 +489,7 @@ """ if self._should_optimise_constant_storage() and cls in (StoreAttr, StoreName) and \ - self._have_constant_input(n) and self._have_constant_input(n-1): + self._have_constant_input(n) and (n == 0 or self._have_constant_input(n-1)): self.remove_ops(n+1) return 1 else: