Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( IdealIntType vm.Type = &types.IdealIntType{} IdealFloatType vm.Type = &types.IdealFloatType{} IdealBoolType vm.Type = &types.BoolType{} )
TODO: move to builtins
Functions ¶
This section is empty.
Types ¶
type BlockCompiler ¶
type BlockCompiler struct {
*FuncCompiler // The FuncCompiler for the function enclosing this block.
Parent *BlockCompiler // The BlockCompiler for the block enclosing this one, or nil for a function-level block.
Block *context.Block // The block definition
Label *Label // The label of this block, used for finding break and continue labels.
}
BlockCompiler captures information used throughout the compilation of a single block within a function.
func (*BlockCompiler) CompileStmt ¶
func (bc *BlockCompiler) CompileStmt(stmt ast.Stmt)
CompileStmt compiles the specified statement within the block.
type CodeBuf ¶
type CodeBuf struct {
// contains filtered or unexported fields
}
func NewCodeBuf ¶
func NewCodeBuf() *CodeBuf
type Compiler ¶
type Compiler struct {
FSet *token.FileSet
Errors *scanner.ErrorList
NumErrors int
SilentErrors int
}
Compiler captures information used throughout a package compilation.
func (*Compiler) CompileExpr ¶
type Expr ¶
type Expr struct {
*ExprInfo
// The type of the expression
ExprType vm.Type
// Execute this expression as a statement.
// Only expressions that are valid expression statements should set this.
Exec vm.CodeInstruction
// contains filtered or unexported fields
}
Expr is the result of compiling an expression. It stores the type of the expression and its evaluator function.
type ExprCompiler ¶
type ExprCompiler struct {
*Compiler
// contains filtered or unexported fields
}
ExprCompiler stores information used throughout the compilation of a single expression. It does not embed funcCompiler because expressions can appear at top level.
type ExprInfo ¶
type ExprInfo struct {
*Compiler
// contains filtered or unexported fields
}
ExprInfo stores information needed to compile any expression node. Each expr also stores its exprInfo so further expressions can be compiled from it.
type FlowBuf ¶
type FlowBuf struct {
// contains filtered or unexported fields
}
func NewFlowBuf ¶
NewFlowBuf creates a new FlowBuf using the specified CodeBuf
type FuncCompiler ¶
type FuncCompiler struct {
*Compiler // The Compiler for the package enclosing this function.
*CodeBuf //
FnType *types.FuncType //
OutVarsNamed bool // Whether the out variables are named. This affects what kinds of return statements are legal.
Flow *FlowBuf //
Labels map[string]*Label //
}
FuncCompiler captures information used throughout the compilation of a single function body.
func (*FuncCompiler) CheckLabels ¶
func (fc *FuncCompiler) CheckLabels()
CheckLabels checks that labels were resolved and that all jumps obey scoping rules. Reports an error and set fc.err if any check fails.