1.1 --- a/simplify/annotate.py Mon Aug 06 00:54:45 2007 +0200
1.2 +++ b/simplify/annotate.py Sun Aug 12 00:32:16 2007 +0200
1.3 @@ -121,9 +121,9 @@
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, CheckType, Conditional, Global, Import, InvokeRef,
1.8 - InvokeFunction, LoadAttr, LoadExc, LoadName, LoadRef, LoadTemp,
1.9 - Module, Not, Pass, Raise, ReleaseTemp, ReturnFromBlock,
1.10 + Covered: Assign, CheckType, Conditional, Constant, Global, Import,
1.11 + InvokeRef, InvokeFunction, LoadAttr, LoadExc, LoadName, LoadRef,
1.12 + LoadTemp, Module, Not, Pass, Raise, ReleaseTemp, ReturnFromBlock,
1.13 ReturnFromFunction, StoreAttr, StoreName, StoreTemp, Subprogram,
1.14 Try.
1.15 """
1.16 @@ -425,6 +425,17 @@
1.17 if exc_type not in body_namespace.raises:
1.18 self.namespace.revoke_exception_type(exc_type)
1.19
1.20 + def visitConstant(self, const):
1.21 +
1.22 + """
1.23 + Process the 'const' node, producing the appropriate type information
1.24 + for the value represented.
1.25 + """
1.26 +
1.27 + attrs = self.get_builtin_instances(const, const.typename)
1.28 + self.namespace.set_types(attrs)
1.29 + self.annotate(const)
1.30 +
1.31 def visitGlobal(self, global_):
1.32
1.33 """
1.34 @@ -1308,16 +1319,13 @@
1.35
1.36 # NOTE: Constant not added to table.
1.37
1.38 - constant = Constant(name=repr(arg), value=arg)
1.39 code += [
1.40 StoreTemp(
1.41 instance=instance,
1.42 - expr=InvokeFunction(
1.43 + expr=Constant(
1.44 instance=instance,
1.45 - expr=LoadName(
1.46 - instance=instance,
1.47 - name=constant.typename
1.48 - )
1.49 + name=repr(arg),
1.50 + value=arg
1.51 ),
1.52 index="const"
1.53 ),