1.1 --- a/micropython/trans.py Sat Feb 06 21:00:28 2010 +0100
1.2 +++ b/micropython/trans.py Sun Feb 07 02:02:15 2010 +0100
1.3 @@ -317,13 +317,13 @@
1.4
1.5 # Get the names of all object types supporting these names.
1.6
1.7 - target_names = self.objtable.all_possible_objects(names_used)
1.8 + targets = self.objtable.all_possible_objects_plus_status(names_used)
1.9
1.10 # Where only one object type is suggested, produce a guard.
1.11 # NOTE: This only supports classes as types, not modules.
1.12
1.13 - if len(target_names) == 1:
1.14 - target_name = target_names[0]
1.15 + if len(targets) == 1:
1.16 + target_name, is_static = targets[0]
1.17
1.18 # Access the object table to get the attribute.
1.19 # NOTE: This depends on the special entry in the table
1.20 @@ -343,15 +343,22 @@
1.21 self.new_op(LoadClass(attr))
1.22 temp_target = self.optimiser.optimise_temp_storage()
1.23
1.24 - # Generate name is target (for classes).
1.25 + # For only static attributes, classes are acceptable.
1.26 +
1.27 + if is_static:
1.28 +
1.29 + # Generate name is target (for classes).
1.30
1.31 - self.dispatch(compiler.ast.Name(name))
1.32 - self.new_op(TestIdentity())
1.33 - self.optimiser.set_source(temp_target)
1.34 + self.dispatch(compiler.ast.Name(name))
1.35 + self.new_op(TestIdentity())
1.36 + self.optimiser.set_source(temp_target)
1.37
1.38 - # Jump to the next guard or the code if successful.
1.39 + # Jump to the next guard or the code if successful.
1.40
1.41 - self.new_op(JumpIfTrue(after_test_block))
1.42 + self.new_op(JumpIfTrue(after_test_block))
1.43 +
1.44 + # Where instance attributes are involved, only instances are
1.45 + # acceptable.
1.46
1.47 # Generate isinstance(name, target).
1.48