Documentation ¶
Overview ¶
compile python code
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Compile ¶
Compile(source, filename, mode, flags, dont_inherit) -> code object
Compile the source string (a Python module, statement or expression) into a code object that can be executed by exec() or eval(). The filename will be used for run-time error messages. The mode must be 'exec' to compile a module, 'single' to compile a single (interactive) statement, or 'eval' to compile an expression. The flags argument, if present, controls which future statements influence the compilation of the code. The dont_inherit argument, if non-zero, stops the compilation inheriting the effects of any future statements in effect in the code calling compile; if absent or zero these statements do influence the compilation, in addition to any features explicitly specified.
func LegacyCompile ¶
Compile(source, filename, mode, flags, dont_inherit) -> code object
Compile the source string (a Python module, statement or expression) into a code object that can be executed by exec() or eval(). The filename will be used for run-time error messages. The mode must be 'exec' to compile a module, 'single' to compile a single (interactive) statement, or 'eval' to compile an expression. The flags argument, if present, controls which future statements influence the compilation of the code. The dont_inherit argument, if non-zero, stops the compilation inheriting the effects of any future statements in effect in the code calling compile; if absent or zero these statements do influence the compilation, in addition to any features explicitly specified.
Types ¶
type Instruction ¶
type Instructions ¶
type Instructions []Instruction
Resolved or unresolved instruction stream
func (*Instructions) Add ¶
func (is *Instructions) Add(i Instruction)
Add an instruction to the instructions
func (Instructions) Assemble ¶
func (is Instructions) Assemble() string
Assemble the instructions into an Opcode string
func (Instructions) EndsWithReturn ¶
func (is Instructions) EndsWithReturn() bool
EndsWithReturn returns true if the instruction stream ends with a RETURN_VALUE
func (Instructions) Lnotab ¶
func (is Instructions) Lnotab() []byte
Creates the lnotab from the instruction stream
See Objects/lnotab_notes.txt for the description of the line number table.
func (Instructions) Pass ¶
func (is Instructions) Pass(pass int) bool
Do a pass of assembly
Returns a boolean as to whether the stream changed
func (Instructions) StackDepth ¶
func (is Instructions) StackDepth() int
Find the flow path that needs the largest stack. We assume that cycles in the flow graph have no net effect on the stack depth.
type Label ¶
type Label struct {
// contains filtered or unexported fields
}
A label