1.1 --- a/translator.py Mon Feb 27 20:20:54 2017 +0100
1.2 +++ b/translator.py Mon Feb 27 23:43:24 2017 +0100
1.3 @@ -78,19 +78,13 @@
1.4
1.5 # Classes representing intermediate translation results.
1.6
1.7 -class TranslationResult:
1.8 -
1.9 - "An abstract translation result mix-in."
1.10 -
1.11 - pass
1.12 -
1.13 -class ReturnRef(TranslationResult):
1.14 +class ReturnRef:
1.15
1.16 "Indicates usage of a return statement."
1.17
1.18 pass
1.19
1.20 -class Expression(results.Result, TranslationResult):
1.21 +class Expression(results.Result):
1.22
1.23 "A general expression."
1.24
1.25 @@ -101,7 +95,7 @@
1.26 def __repr__(self):
1.27 return "Expression(%r)" % self.s
1.28
1.29 -class TrResolvedNameRef(results.ResolvedNameRef, TranslationResult):
1.30 +class TrResolvedNameRef(results.ResolvedNameRef):
1.31
1.32 "A reference to a name in the translation."
1.33
1.34 @@ -169,21 +163,21 @@
1.35 else:
1.36 return "(%s%s)" % (self.parameter and "*" or "", attrname)
1.37
1.38 -class TrConstantValueRef(results.ConstantValueRef, TranslationResult):
1.39 +class TrConstantValueRef(results.ConstantValueRef):
1.40
1.41 "A constant value reference in the translation."
1.42
1.43 def __str__(self):
1.44 return encode_literal_constant(self.number)
1.45
1.46 -class TrLiteralSequenceRef(results.LiteralSequenceRef, TranslationResult):
1.47 +class TrLiteralSequenceRef(results.LiteralSequenceRef):
1.48
1.49 "A reference representing a sequence of values."
1.50
1.51 def __str__(self):
1.52 return str(self.node)
1.53
1.54 -class TrInstanceRef(results.InstanceRef, TranslationResult):
1.55 +class TrInstanceRef(results.InstanceRef):
1.56
1.57 "A reference representing instantiation of a class."
1.58
1.59 @@ -203,7 +197,7 @@
1.60 def __repr__(self):
1.61 return "TrResolvedInstanceRef(%r, %r)" % (self.ref, self.expr)
1.62
1.63 -class AttrResult(Expression, InstructionSequence):
1.64 +class AttrResult(results.Result, InstructionSequence):
1.65
1.66 "A translation result for an attribute access."
1.67
1.68 @@ -242,13 +236,10 @@
1.69 def __repr__(self):
1.70 return "AttrResult(%r, %r, %r)" % (self.instructions, self.refs, self.location)
1.71
1.72 -class InvocationResult(Expression, InstructionSequence):
1.73 +class InvocationResult(results.Result, InstructionSequence):
1.74
1.75 "A translation result for an invocation."
1.76
1.77 - def __init__(self, instructions):
1.78 - InstructionSequence.__init__(self, instructions)
1.79 -
1.80 def __str__(self):
1.81 return encode_instructions(self.instructions)
1.82
1.83 @@ -266,7 +257,7 @@
1.84 def __repr__(self):
1.85 return "InstantiationResult(%r, %r)" % (self.ref, self.instructions)
1.86
1.87 -class PredefinedConstantRef(Expression):
1.88 +class PredefinedConstantRef(results.Result):
1.89
1.90 "A predefined constant reference."
1.91
1.92 @@ -295,17 +286,7 @@
1.93 def __repr__(self):
1.94 return "PredefinedConstantRef(%r)" % self.value
1.95
1.96 -class BooleanResult(Expression):
1.97 -
1.98 - "A expression producing a boolean result."
1.99 -
1.100 - def __str__(self):
1.101 - return "__builtins___bool_bool(%s)" % self.s
1.102 -
1.103 - def __repr__(self):
1.104 - return "BooleanResult(%r)" % self.s
1.105 -
1.106 -class LogicalResult(TranslationResult):
1.107 +class LogicalResult(results.Result):
1.108
1.109 "A logical expression result."
1.110