1.1 --- a/micropython/rsvp.py Mon Sep 01 01:32:32 2008 +0200
1.2 +++ b/micropython/rsvp.py Thu Sep 04 19:44:39 2008 +0200
1.3 @@ -33,11 +33,13 @@
1.4 elif isinstance(item, Class):
1.5 # NOTE: Need initialiser details!
1.6 new_code.append((
1.7 - objtable.as_list().get_code(item.full_name()),
1.8 - objtable.get_index(item.full_name()),
1.9 - item.get_instantiator().code_location,
1.10 - len(item.get_instantiator().positional_names)
1.11 - ))
1.12 + objtable.as_list().get_code(item.full_name()),
1.13 + objtable.get_index(item.full_name()),
1.14 + item.get_instantiator().code_location,
1.15 + (
1.16 + len(item.get_instantiator().positional_names),
1.17 + len(item.get_instantiator().defaults)
1.18 + )))
1.19 elif isinstance(item, Const):
1.20 # NOTE: Need class details!
1.21 new_code.append((
1.22 @@ -51,8 +53,10 @@
1.23 objtable.as_list().get_code("__builtins__.function"),
1.24 objtable.get_index("__builtins__.function"),
1.25 item.code_location,
1.26 - len(item.positional_names)
1.27 - ))
1.28 + (
1.29 + len(item.positional_names),
1.30 + len(item.defaults)
1.31 + )))
1.32 else:
1.33 new_code.append(item)
1.34 return new_code
1.35 @@ -200,6 +204,11 @@
1.36 class LoadAttrIndex(Immediate): "Load into the current value the attribute of the current value with the given index."
1.37 class StoreAttrIndex(Immediate): "Store an object in the attribute with the given index."
1.38
1.39 +# Access to object details.
1.40 +
1.41 +class LoadCallable(Instruction): "Load the target of an invocation."
1.42 +class StoreCallable(Instruction): "Store the source value into the object referenced by the current value."
1.43 +
1.44 # Access to invocation frames in preparation.
1.45
1.46 class MakeFrame(Immediate): "Make a new invocation frame."
1.47 @@ -207,8 +216,6 @@
1.48 class RecoverFrame(Instruction): "Recover the current frame as an invocation frame."
1.49 class StoreFrame(Immediate): "Store the current value as an argument for the parameter with the given position."
1.50 class StoreFrameIndex(Immediate): "Store the current value as an argument for the parameter with the given index."
1.51 -class LoadCallable(Instruction): "Load the target of an invocation."
1.52 -class StoreCallable(Instruction): "Store the source value into the object referenced by the current value."
1.53 class LoadContext(Instruction): "Load the context of an invocation."
1.54 class CheckFrame(Immediate): "Check the invocation frame and context for the target."
1.55 class CheckSelf(Instruction): "Check the first argument of an invocation against the target."