1.1 --- a/rsvp.py Sun May 31 18:44:40 2009 +0200
1.2 +++ b/rsvp.py Mon Jun 01 02:41:57 2009 +0200
1.3 @@ -52,7 +52,6 @@
1.4 current callable
1.5 """
1.6
1.7 -from micropython.program import DataObject # for creating "nice" new objects
1.8 import operator
1.9
1.10 class IllegalInstruction(Exception):
1.11 @@ -432,7 +431,7 @@
1.12 context = source_context
1.13 self.save(self.operand, (context, source_ref))
1.14
1.15 - def MakeObject(self):
1.16 + def MakeInstance(self):
1.17 size = self.operand
1.18 context, ref = self.value
1.19 # NOTE: Referencing the instance template.
1.20 @@ -538,7 +537,7 @@
1.21 context, ref = self.value
1.22 # NOTE: Should improve the representation and permit direct saving.
1.23 data = self.load(ref)
1.24 - self.save(ref, (data.classcode, data.attrcode) + self.callable)
1.25 + self.save(ref, data.with_callable(self.callable))
1.26
1.27 def LoadContext(self):
1.28 context, ref = self.value
1.29 @@ -575,9 +574,8 @@
1.30 return self.RaiseException()
1.31
1.32 def FillDefaults(self):
1.33 - # NOTE: Make the get_operand method of the instruction provide the
1.34 - # NOTE: function location.
1.35 - (nargs, ndefaults, fn) = self.operand
1.36 + context, ref = self.value
1.37 + (nargs, ndefaults) = self.operand
1.38
1.39 # The frame is actually installed as the locals.
1.40
1.41 @@ -590,7 +588,6 @@
1.42 default = nlocals - (nargs - ndefaults)
1.43 self.frame_stack.extend([None] * (nargs - nlocals))
1.44 pos = nlocals
1.45 - ref = fn.location
1.46
1.47 while pos < nargs:
1.48 self.frame_stack[frame + pos] = self.load(ref + default + 1) # skip header
1.49 @@ -914,6 +911,7 @@
1.50
1.51 native_functions = {
1.52 "__builtins__.int.__add__" : builtins_int_add,
1.53 + "__builtins__.int.__radd__" : builtins_int_add, # NOTE: To be made distinct.
1.54 "__builtins__.int.__bool__" : builtins_int_bool,
1.55 "__builtins__.int.__neg__" : builtins_int_neg,
1.56 "__builtins__.int.__lt__" : builtins_int_lt,