cps/returns

Source   Edit  

Procs

proc dismiss() {.used, cpsMustJump, cpsMagicCall, ...raises: [], tags: [],
                 forbids: [].}
Source   Edit  
proc dismiss(continuation: sink Continuation): Continuation {.used, ...raises: [],
    tags: [], forbids: [].}
A convenience which simply discards the continuation. Source   Edit  
proc firstReturn(p: NormNode): NormNode {....raises: [], tags: [], forbids: [].}
Find the first control-flow return statement or cps control-flow within statement lists; else, nil. Source   Edit  
proc jumperCall(cont, contType, to: Name; via: NormNode): NormNode {....raises: [],
    tags: [], forbids: [].}
Produce a tail call to to with cont as the continuation The via argument is expected to be a cps jumper call. Source   Edit  
proc makeReturn(contType: Name; n: NormNode): NormNode {....raises: [], tags: [],
    forbids: [].}
generate a return of the node if it doesn't already contain a return Source   Edit  
proc makeReturn(contType: Name; pre, n: NormNode): NormNode {....raises: [],
    tags: [], forbids: [].}
if pre holds no return, produce a return of n after pre Source   Edit  
proc tailCall(cont, contType, to: Name; jump: NormNode = NilNormNode): NormNode {.
    ...raises: [], tags: [], forbids: [].}
a tail call to to with cont as the continuation; if the jump is supplied, return that call instead of the continuation itself Source   Edit  
proc terminator(c: Name; contType: Name; tipe: NormNode): NormNode {....raises: [],
    tags: [], forbids: [].}
produce the terminating return statement of the continuation; this should return control to the mom and dealloc the continuation, or simply set the fn to nil and return the continuation. Source   Edit  

Templates

template pass(source: Continuation; destination: Continuation): Continuation {.
    used.}
This symbol may be reimplemented to introduce logic during the transfer of control between parent and child continuations. The return value specifies the destination continuation. Source   Edit