1.1 --- a/simplify/annotate.py Sun Jul 29 20:33:09 2007 +0200
1.2 +++ b/simplify/annotate.py Sun Jul 29 23:29:19 2007 +0200
1.3 @@ -193,7 +193,7 @@
1.4
1.5 # Add namespace details to any structure involved.
1.6
1.7 - if getattr(node, "structure", None) is not None:
1.8 + if node.structure is not None:
1.9 node.structure.namespace = Namespace()
1.10
1.11 # Initialise bases where appropriate.
1.12 @@ -285,9 +285,6 @@
1.13 system's annotation counter.
1.14 """
1.15
1.16 - if not hasattr(node, "paramtypes"):
1.17 - node.paramtypes = {}
1.18 -
1.19 for param, types in items:
1.20 if not node.paramtypes.has_key(param):
1.21 node.paramtypes[param] = set()
1.22 @@ -444,7 +441,7 @@
1.23 and storing details on the node.
1.24 """
1.25
1.26 - module = self.importer.load(import_.name, self.builtins, getattr(import_, "alias", None))
1.27 + module = self.importer.load(import_.name, self.builtins, import_.alias)
1.28 if module is not None:
1.29 self.namespace.set_types(set([module]))
1.30 else:
1.31 @@ -787,7 +784,7 @@
1.32 those raised in the namespace.
1.33 """
1.34
1.35 - if getattr(raise_, "traceback", None) is not None:
1.36 + if raise_.traceback is not None:
1.37 self.dispatch(raise_.traceback)
1.38 self.dispatch(raise_.expr)
1.39
1.40 @@ -1021,14 +1018,14 @@
1.41 # Provide the correct namespace for the invocation.
1.42 # This may be a "shared" namespace...
1.43
1.44 - if getattr(invoke, "share_locals", 0):
1.45 + if invoke.share_locals:
1.46 namespace = Namespace()
1.47 namespace.merge_namespace(self.namespace, everything=0)
1.48 using_module_namespace = self.namespace is self.module.namespace
1.49
1.50 # Or it may be a structure...
1.51
1.52 - elif getattr(target, "structure", None):
1.53 + elif target.structure:
1.54 namespace = Namespace()
1.55 using_module_namespace = 0
1.56
1.57 @@ -1044,7 +1041,7 @@
1.58 # NOTE: subprogram within itself. Do not define the name of the function
1.59 # NOTE: within a method definition.
1.60
1.61 - if getattr(target, "name", None) is not None and not getattr(target, "is_method", 0):
1.62 + if target.name is not None and not target.is_method:
1.63 namespace.store(target.name, set([Attribute(None, target)]))
1.64
1.65 # Process the subprogram.
1.66 @@ -1054,7 +1051,7 @@
1.67 # NOTE: Improve and verify this.
1.68 # If the invocation returns a value, acquire the return types.
1.69
1.70 - if getattr(target, "returns_value", 0):
1.71 + if target.returns_value:
1.72 self.namespace.set_types(target.returns)
1.73 self.annotate(invoke)
1.74
1.75 @@ -1063,7 +1060,7 @@
1.76 # logical expressions, the namespace can be modified whilst values are
1.77 # returned as results.
1.78
1.79 - if getattr(invoke, "share_locals", 0):
1.80 + if invoke.share_locals:
1.81 self.namespace.reset()
1.82
1.83 # Merge the locals snapshots.
1.84 @@ -1073,7 +1070,7 @@
1.85 # For blocks returning values (such as operations), do not merge
1.86 # snapshots or results.
1.87
1.88 - if getattr(target, "returns_value", 0):
1.89 + if target.returns_value:
1.90 self.namespace.merge_namespace(locals, everything=0, temp=0)
1.91
1.92 # For blocks not returning values (such as loops), merge
1.93 @@ -1085,8 +1082,6 @@
1.94
1.95 # Incorporate any raised exceptions.
1.96
1.97 - if not hasattr(invoke, "raises"):
1.98 - invoke.raises = set()
1.99 invoke.raises.update(target.raises)
1.100 self.namespace.raises.update(target.raises)
1.101