1.1 --- a/rsvp.py Tue Aug 19 00:41:30 2008 +0200
1.2 +++ b/rsvp.py Thu Aug 21 00:49:15 2008 +0200
1.3 @@ -241,12 +241,8 @@
1.4
1.5 def LoadAttr(self):
1.6 context, ref = self.value
1.7 - loaded_context, loaded_ref = self.load(ref + self.operand)
1.8 - if loaded_context is None:
1.9 - # Override null context with owning instance.
1.10 - self.value = ref, loaded_ref
1.11 - else:
1.12 - self.value = loaded_context, loaded_ref
1.13 + # Retrieved context should already be appropriate for the instance.
1.14 + self.value = self.load(ref + self.operand)
1.15
1.16 def StoreAttr(self):
1.17 context, ref = self.value
1.18 @@ -256,18 +252,24 @@
1.19 context, ref = self.value
1.20 code = self.load(ref) # + 0 (the classcode)
1.21 element = self.objtable[code + self.operand]
1.22 - found_code, found_attr = element
1.23 + found_code, class_attr, replace_context, offset = element
1.24 if found_code == code:
1.25 - # NOTE: The found context should be tested against the object's context.
1.26 - # NOTE: Compatibility between contexts should be stored in the table, or
1.27 - # NOTE: an incompatible context should be preserved.
1.28 - self.value = ref, found_ref
1.29 + if class_attr:
1.30 + loaded_context, loaded_ref = self.load(offset) # offset is address of class attribute
1.31 + if replace_context:
1.32 + self.value = ref, loaded_ref # classes can also replace the context if compatible
1.33 + return
1.34 + self.value = loaded_context, loaded_ref
1.35 + else:
1.36 + self.value = self.load(ref + offset)
1.37 else:
1.38 # NOTE: This should cause an attribute error.
1.39 self.value = None
1.40
1.41 def StoreAttrIndex(self): pass
1.42
1.43 + # NOTE: LoadAttrIndexContext is a possibility if a particular attribute can always be overridden.
1.44 +
1.45 def MakeFrame(self):
1.46 self.invocation_sp_stack.append(len(self.frame_stack))
1.47 self.frame_stack.extend([None] * self.operand)