1.1 --- a/annotate.py Wed Dec 06 00:48:29 2006 +0100
1.2 +++ b/annotate.py Wed Dec 06 23:54:48 2006 +0100
1.3 @@ -117,12 +117,12 @@
1.4 types possible when the means of constructing the namespace may depend on
1.5 run-time behaviour.
1.6
1.7 - Covered: Assign, CheckExc, Conditional, InvokeBlock, InvokeFunction,
1.8 + Covered: Assign, CheckExc, Conditional, Global, InvokeBlock, InvokeFunction,
1.9 LoadAttr, LoadExc, LoadName, LoadRef, LoadTemp, Module, Not, Pass,
1.10 Raise, ReleaseTemp, ReturnFromBlock, ReturnFromFunction, StoreAttr,
1.11 StoreName, StoreTemp, Subprogram, Try.
1.12
1.13 - Missing: Global, Import.
1.14 + Missing: Import.
1.15 """
1.16
1.17 def __init__(self):
1.18 @@ -357,6 +357,15 @@
1.19
1.20 return conditional
1.21
1.22 + def visitGlobal(self, global_):
1.23 +
1.24 + """
1.25 + Return the 'global_' node unprocessed since namespaces should have
1.26 + already been altered to take global names into consideration.
1.27 + """
1.28 +
1.29 + return global_
1.30 +
1.31 def _visitInvoke(self, invoke, invocation_types, have_args):
1.32
1.33 """
3.1 --- a/viewer.py Wed Dec 06 00:48:29 2006 +0100
3.2 +++ b/viewer.py Wed Dec 06 23:54:48 2006 +0100
3.3 @@ -126,14 +126,14 @@
3.4
3.5 Covered: Add, And, AssAttr, AssList, AssName, AssTuple, Assign, AugAssign,
3.6 Break, CallFunc, Class, Compare, Const, Continue, Dict, Discard,
3.7 - Div, FloorDiv, For, Function, Getattr, If, Keyword, Lambda, List,
3.8 - Module, Mul, Name, Not, Or, Pass, Print, Printnl, Raise, Return,
3.9 - Slice, Stmt, Sub, Subscript, TryExcept, TryFinally, Tuple,
3.10 + Div, FloorDiv, For, Function, Getattr, Global, If, Keyword, Lambda,
3.11 + List, Module, Mul, Name, Not, Or, Pass, Print, Printnl, Raise,
3.12 + Return, Slice, Stmt, Sub, Subscript, TryExcept, TryFinally, Tuple,
3.13 UnaryAdd, UnarySub, While.
3.14
3.15 Missing: Assert, Backquote, Bitand, Bitor, Bitxor, Decorators, Ellipsis,
3.16 - Exec, From, Global, Import, Invert, LeftShift, ListComp,
3.17 - ListCompFor, ListCompIf, Mod, Power, RightShift, Sliceobj, Yield.
3.18 + Exec, From, Import, Invert, LeftShift, ListComp, ListCompFor,
3.19 + ListCompIf, Mod, Power, RightShift, Sliceobj, Yield.
3.20 """
3.21
3.22 def __init__(self, stream):
3.23 @@ -278,6 +278,17 @@
3.24 self.stream.write("</div>\n")
3.25 self.stream.write("</div>\n")
3.26
3.27 + def visitGlobal(self, node):
3.28 + self.stream.write("<div class='global'>\n")
3.29 + self._keyword("global")
3.30 + first = 1
3.31 + for name in node.names:
3.32 + if not first:
3.33 + self.stream.write(",\n")
3.34 + self.stream.write(name)
3.35 + first = 0
3.36 + self.stream.write("</div>\n")
3.37 +
3.38 def visitIf(self, node):
3.39 self.stream.write("<div class='if'>\n")
3.40 first = 1