Copy Method Parameters Property
During a method call, LW Python looks up the method definition to get the method's parameters and copies them to "Parameters." More formally,
if the following are true:
- expression state at time t = "call_function_begin"
- the expression at time t = obj_name.method_name(args)
- value at obj_name in map (Variables Map at time t) = Python reference index
- the element at index index of stack (Python Object Store at time t) = Python object: [ entry "__class_name__": class_name, e_rest ]
- method parameters where the Class Map is (Class Map at time t), class name is class_name, and method name is method_name = params
then Parameters List at time (t + 1) = params
if the following are true:
- expression state at time 56 = "call_function_begin"
- the expression at time 56 =
p.age_in_months()
- value at p in map (Variables Map at time 56) = Python reference 0
- the element at index 0 of stack (Python Object Store at time 56) = Python object: [ entry "__class_name__": "Person", [ entry "first_name": "John", [ entry "last_name": "Smith", [ entry "age": 25, [ ] ] ] ] ]
- method parameters where the Class Map is (Class Map at time 56), class name is "Person", and method name is "age_in_months" = [ self, [ ] ]
then Parameters List at time (56 + 1) = [ self, [ ] ]
Try stepping through the simulator to see LW Python copy the method parameters to "Parameters."
Code Editor
LW Python State
Current Line | 1 | Current Tab | 0 | Time | 0 |
LW Python Simulator
Comments
Please log in to add comments