1.1 --- a/micropython/rsvp.py Tue Nov 01 01:16:09 2011 +0100
1.2 +++ b/micropython/rsvp.py Thu Nov 17 01:49:57 2011 +0100
1.3 @@ -317,11 +317,13 @@
1.4 return self.__class__(self.attr, self.working, self.target, self.source)
1.5
1.6 def __repr__(self):
1.7 - return "%s(%s%s%s%s)" % (self.__class__.__name__,
1.8 - self.format_operand(),
1.9 - self.format_working(),
1.10 - self.format_source(),
1.11 - self.format_target())
1.12 + return "%s(%s)" % (self.__class__.__name__,
1.13 + ", ".join(
1.14 + self.format_operand() +
1.15 + self.format_working() +
1.16 + self.format_source() +
1.17 + self.format_target()
1.18 + ))
1.19
1.20 def __hash__(self):
1.21 return hash(self.get_details())
1.22 @@ -334,16 +336,16 @@
1.23
1.24 def format_operand(self):
1.25 operand = self.get_operand()
1.26 - return operand is not None and repr(operand) or ""
1.27 + return operand is not None and [repr(operand)] or []
1.28
1.29 def format_working(self):
1.30 - return self.working != self.default_working and (", working=%r" % self.working) or ""
1.31 + return self.working != self.default_working and ["working=%r" % self.working] or []
1.32
1.33 def format_source(self):
1.34 - return self.source != self.default_source and (", source=%r" % self.source) or ""
1.35 + return self.source != self.default_source and ["source=%r" % self.source] or []
1.36
1.37 def format_target(self):
1.38 - return self.target != self.default_target and (", target=%r" % self.target) or ""
1.39 + return self.target != self.default_target and ["target=%r" % self.target] or []
1.40
1.41 def get_operand(self):
1.42 return None
1.43 @@ -362,7 +364,7 @@
1.44 "An instruction accessing an object's attribute."
1.45
1.46 def format_operand(self):
1.47 - return "%s, name=%r" % (Instruction.format_operand(self), name(self.attr))
1.48 + return Instruction.format_operand(self) + ["name=%r" % name(self.attr)]
1.49
1.50 def get_operand(self):
1.51 return self.attr.position
1.52 @@ -376,12 +378,12 @@
1.53 def format_operand(self):
1.54 location, position, result = self.get_operands()
1.55 if location is not None:
1.56 - return "%s, location=%s, position=%s, name=%s" % (
1.57 - result, location, position, name(self.attr))
1.58 + return ["%s" % result, "location=%s" % location, "position=%s" % position,
1.59 + "name=%s" % name(self.attr)]
1.60 elif result is not None:
1.61 - return "%s, name=%s" % (result, name(self.attr))
1.62 + return ["%s" % result, "name=%s" % name(self.attr)]
1.63 else:
1.64 - return "name=%s" % name(self.attr)
1.65 + return ["name=%s" % name(self.attr)]
1.66
1.67 def get_operands(self):
1.68 if isinstance(self.attr, Attr):
1.69 @@ -410,7 +412,7 @@
1.70 "An instruction loading the address of an invocation target."
1.71
1.72 def format_operand(self):
1.73 - return "%s, name=%r" % (Instruction.format_operand(self), name(self.attr))
1.74 + return Instruction.format_operand(self) + ["name=%r" % name(self.attr)]
1.75
1.76 def get_operand(self):
1.77 return self.attr.code_body_location
1.78 @@ -627,6 +629,11 @@
1.79 cost = 2
1.80 default_target = None
1.81
1.82 +class JumpInFrameDirect(Address):
1.83 + "Jump, using the current locals, to the specified address."
1.84 + cost = 2
1.85 + default_target = None
1.86 +
1.87 class JumpWithFrame(Instruction):
1.88 "Jump, adopting the invocation frame, to the current callable."
1.89 cost = 3
1.90 @@ -708,7 +715,10 @@
1.91 """
1.92
1.93 return instruction.target == register or isinstance(instruction, (
1.94 - JumpWithFrame, JumpWithFrameDirect, JumpIfTrue, JumpIfFalse, Jump
1.95 + JumpInFrame, JumpInFrameDirect,
1.96 + JumpWithFrame, JumpWithFrameDirect,
1.97 + JumpIfTrue, JumpIfFalse,
1.98 + Jump
1.99 ))
1.100
1.101 # vim: tabstop=4 expandtab shiftwidth=4