C# Class kOS.Safe.Compilation.OpcodeReturn

Returns from an OpcodeCall, popping a number of scope depths off the stack as it does so. It evals the topmost thing on the stack. to remove any local variable references and replace them with their current values, and then performs the equivalent of a popscope, then jumps back to where the routine was called from. It also checks to ensure that the argument stack contains the arg bottom marker. If it does not, that proves the number of parameters consumed did not match the number of arguments passed and it throws an exception (to avoid stack misalignment that would happen if it tried to continue).
Inheritance: Opcode
Mostrar archivo Open project: KSP-KOS/KOS

Private Properties

Property Type Description
OpcodeReturn System

Public Methods

Method Description
Execute ( ICpu cpu ) : void
OpcodeReturn ( Int16 depth ) : System

Make a return, telling it how many levels of the scope stack it should be popping as it does so. It combines the behavior of a PopScope inside itself, AFTER it reads and evaluates the thing atop the stack for return purposes (that way it evals the top thing BEFORE it pops the scope and forgets what variables exist).

Doing this:
push $val
return 2 deep
is the same as this:
push $val
eval
popscope 2
return 0 deep

PopulateFromMLFields ( List fields ) : void
ToString ( ) : string

Private Methods

Method Description
OpcodeReturn ( ) : System

Method Details

Execute() public method

public Execute ( ICpu cpu ) : void
cpu ICpu
return void

OpcodeReturn() public method

Make a return, telling it how many levels of the scope stack it should be popping as it does so. It combines the behavior of a PopScope inside itself, AFTER it reads and evaluates the thing atop the stack for return purposes (that way it evals the top thing BEFORE it pops the scope and forgets what variables exist).

Doing this:
push $val
return 2 deep
is the same as this:
push $val
eval
popscope 2
return 0 deep

public OpcodeReturn ( Int16 depth ) : System
depth System.Int16 the number of levels to be popped
return System

PopulateFromMLFields() public method

public PopulateFromMLFields ( List fields ) : void
fields List
return void

ToString() public method

public ToString ( ) : string
return string