1.1 --- a/micropython/inspect.py Sun Feb 07 03:02:39 2010 +0100
1.2 +++ b/micropython/inspect.py Mon Feb 08 01:05:23 2010 +0100
1.3 @@ -3,7 +3,7 @@
1.4 """
1.5 Inspect source files, obtaining details of classes and attributes.
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 @@ -332,6 +332,9 @@
1.13 def new_branch(self):
1.14 self.get_namespace()._new_branch()
1.15
1.16 + def abandon_branch(self):
1.17 + self.get_namespace()._abandon_branch()
1.18 +
1.19 def shelve_branch(self):
1.20 self.get_namespace()._shelve_branch()
1.21
1.22 @@ -347,9 +350,6 @@
1.23
1.24 self.get_namespace()._define_attribute_user(node)
1.25
1.26 - def reset_all_attributes(self):
1.27 - self.get_namespace()._reset_all_attributes()
1.28 -
1.29 def use_attribute(self, name, attrname):
1.30 return self.get_namespace()._use_attribute(name, attrname)
1.31
1.32 @@ -374,6 +374,10 @@
1.33 self.dispatch(n)
1.34 return None
1.35
1.36 + def NOP_ABANDON(self, node):
1.37 + self.abandon_branch()
1.38 + self.NOP(node)
1.39 +
1.40 def OP(self, node):
1.41 for n in node.getChildNodes():
1.42 self.dispatch(n)
1.43 @@ -558,8 +562,7 @@
1.44
1.45 visitBitxor = _visitBinary
1.46
1.47 - def visitBreak(self, node):
1.48 - self.reset_all_attributes()
1.49 + visitBreak = NOP_ABANDON
1.50
1.51 visitCallFunc = OP
1.52
1.53 @@ -639,8 +642,7 @@
1.54 self.use_name(self.importer.get_constant_type_name(node.value))
1.55 return self.importer.make_constant(node.value)
1.56
1.57 - def visitContinue(self, node):
1.58 - self.reset_all_attributes()
1.59 + visitContinue = NOP_ABANDON
1.60
1.61 visitDecorators = NOP
1.62
1.63 @@ -895,9 +897,9 @@
1.64
1.65 visitPrintnl = NOP
1.66
1.67 - visitRaise = NOP
1.68 + visitRaise = NOP_ABANDON
1.69
1.70 - visitReturn = NOP
1.71 + visitReturn = NOP_ABANDON
1.72
1.73 visitRightShift = _visitBinary
1.74