Jump To Constructor Push Property

When the "Parameters" list is empty, LW Python creates a new "Control" map for the class and the method that LW Python is jumping to. More formally,

if the following are true:
  • expression state at time t = "call_build_args"
  • Parameters List at time t = [ ]
  • the expression at time t = Python constructor with name: class_name and arguments: args
  • line number of method "__init__" of class class_name in (Class Map at time t) = line

then Control Map at time (t + 1) = [ entry 0: (pair ("class", class_name)), [ entry 1: (pair ("method", "__init__")), [ ] ] ]

When LW Python jumps to a method, it creates a new "Control" map which indicates the parent class and method (the old "Control" map is saved in the stack). For example, if the following are true:
  • expression state at time 25 = "call_build_args"
  • Parameters List at time 25 = [ ]
  • the expression at time 25 = Person("John", "Smith", 25)
  • line number of method "__init__" of class "Person" in (Class Map at time 25) = 2

then Control Map at time (25 + 1) = [ entry 0: (pair ("class", "Person")), [ entry 1: (pair ("method", "__init__")), [ ] ] ]

Try stepping through the simulator to see LW Python create a new "Control" map

Code Editor
LW Python State
Current Line1Current Tab0Time0
LW Python Simulator

Comments

Please log in to add comments