# HG changeset patch # User Paul Boddie # Date 1339277058 -7200 # Node ID bbcb39c672017374935ee925613021f2c16c86d0 # Parent 5efb396528ff5b32aeb98d401908abc50933e199 Introduced a method for getting objects from the table using their full names. diff -r 5efb396528ff -r bbcb39c67201 micropython/__init__.py --- a/micropython/__init__.py Sat Jun 09 19:53:00 2012 +0200 +++ b/micropython/__init__.py Sat Jun 09 23:24:18 2012 +0200 @@ -754,7 +754,7 @@ # Get the parent object using the special # table entry. - parent = objtable.access(objname, "#" + objname) + parent = objtable.get_object(objname) # Permit assignment to known instance attributes # only. diff -r 5efb396528ff -r bbcb39c67201 micropython/table.py --- a/micropython/table.py Sat Jun 09 19:53:00 2012 +0200 +++ b/micropython/table.py Sat Jun 09 23:24:18 2012 +0200 @@ -3,7 +3,7 @@ """ Preparation of run-time attribute lookup tables. -Copyright (C) 2007, 2008, 2009, 2010, 2011 Paul Boddie +Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Paul Boddie This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -450,6 +450,18 @@ self.any_cache[names] = self._objects_plus_status(names, self.any_possible_objects) return self.any_cache[names] + def get_object(self, objname): + + """ + Return the object for the given 'objname' using a special entry in the + table. + """ + + # NOTE: This depends on a special entry in the table for class + # NOTE: equivalence tests. + + return self.access(objname, "#" + objname) + class ParameterTable(Table): "A parameter table." diff -r 5efb396528ff -r bbcb39c67201 micropython/trans.py --- a/micropython/trans.py Sat Jun 09 19:53:00 2012 +0200 +++ b/micropython/trans.py Sat Jun 09 23:24:18 2012 +0200 @@ -49,11 +49,11 @@ target_name, is_static = list(targets)[0] # Access the object table to get the attribute. - # NOTE: This depends on the special entry in the table - # NOTE: for class equivalence tests. + # This depends on a special entry in the table for class + # equivalence tests. try: - obj = self.objtable.access(target_name, "#" + target_name) + obj = self.objtable.get_object(target_name) # Where no attribute entry exists, the target could be a module. # NOTE: Should perhaps raise an error.