1.1 --- a/micropython/trans.py Sat Nov 28 21:14:44 2009 +0100
1.2 +++ b/micropython/trans.py Sat Nov 28 21:18:25 2009 +0100
1.3 @@ -506,20 +506,24 @@
1.4
1.5 try:
1.6 attr = self.objtable.access(target_name, attrname)
1.7 +
1.8 + # Disallow non-class/instance optimisations.
1.9 +
1.10 except TableError, exc:
1.11 - raise TranslateError(self.module.full_name(), node, exc.args[0])
1.12 + print "Possible optimisation for", target_name, "not permissable."
1.13
1.14 # Produce a suitable instruction.
1.15
1.16 - if AddressContextCondInstruction is not None and attr.is_static_attribute():
1.17 - self.new_op(AddressContextCondInstruction(attr))
1.18 - elif AttrInstruction is not None and not attr.is_static_attribute():
1.19 - self.new_op(AttrInstruction(attr))
1.20 else:
1.21 - raise TranslateError(self.module.full_name(), node,
1.22 - "Storing of class or module attribute %r via an object is not permitted." % attrname)
1.23 + if AddressContextCondInstruction is not None and attr.is_static_attribute():
1.24 + self.new_op(AddressContextCondInstruction(attr))
1.25 + elif AttrInstruction is not None and not attr.is_static_attribute():
1.26 + self.new_op(AttrInstruction(attr))
1.27 + else:
1.28 + raise TranslateError(self.module.full_name(), node,
1.29 + "Storing of class or module attribute %r via an object is not permitted." % attrname)
1.30
1.31 - return
1.32 + return
1.33
1.34 # Otherwise, perform a normal operation.
1.35