P6C::IMCC::Sub ^

The object representing the current compilation state, at least with respect to the subroutine being currently compiled. Includes the textual PIR code generated so far, a stack of scopes, and a pointer to the parse tree node for the subroutine definition.

Note that many operations on this object are really performed by global subroutines defined in P6C::IMCC. They find the currently compiling object by keeping track of its name in $P6C::IMCC::curfunc, and looking it up in a name -> P6C::IMCC::Sub map called %P6C::IMCC::funcs.

$sub->{code}

The code (not including .local definitions, etc). Should be appended to like $func->{code} .= $thing.

emit($sub)

Emit a complete function body, minus the .sub directive.


parrot