1.1 --- a/micropython/trans.py Sun Feb 07 03:02:39 2010 +0100
1.2 +++ b/micropython/trans.py Mon Feb 08 01:05:23 2010 +0100
1.3 @@ -3,7 +3,7 @@
1.4 """
1.5 Translate the AST of a Python program into a more interpretable representation.
1.6
1.7 -Copyright (C) 2007, 2008, 2009 Paul Boddie <paul@boddie.org.uk>
1.8 +Copyright (C) 2007, 2008, 2009, 2010 Paul Boddie <paul@boddie.org.uk>
1.9
1.10 This program is free software; you can redistribute it and/or modify it under
1.11 the terms of the GNU General Public License as published by the Free Software
1.12 @@ -330,7 +330,7 @@
1.13 # NOTE: for class equivalence tests.
1.14
1.15 try:
1.16 - attr = self.objtable.access(target_name, target_name)
1.17 + obj = self.objtable.access(target_name, target_name)
1.18
1.19 # Where no attribute entry exists, the target could be a module.
1.20
1.21 @@ -338,9 +338,17 @@
1.22 print "Possible guard for", target_name, "not enforceable."
1.23 continue
1.24
1.25 + # NOTE: Could test the correctness of the guard where the nature
1.26 + # NOTE: of the name is known.
1.27 + # NOTE: The known value would be retrieved from the unit's
1.28 + # NOTE: locals and tested as being a class or an instance of a
1.29 + # NOTE: particular class.
1.30 +
1.31 + # Generate the guard by loading a reference to the class.
1.32 +
1.33 after_test_block = self.new_block()
1.34
1.35 - self.new_op(LoadClass(attr))
1.36 + self.new_op(LoadClass(obj))
1.37 temp_target = self.optimiser.optimise_temp_storage()
1.38
1.39 # For only static attributes, classes are acceptable.