Documentation
¶
Overview ¶
Package symbol implements symbol utilities.
Index ¶
Constants ¶
View Source
const UnsetAddr = -65535
UnsetAddr denotes an unset symbol index (vs 0).
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Kind ¶
type Kind int
Kind represents the symbol kind.
const ( Unset Kind = iota Value // a value defined in the runtime Type // a type Label // a label indicating a position in the VM code Const // a constant Var // a variable in global data LocalVar // a variable in the local call frame Func // a function, located in the VM code Pkg // a package Builtin // a built-in function (len, cap, append, etc.) Generic // a generic function or type template )
Symbol kinds.
type SymMap ¶
SymMap is a map of Symbols.
type Symbol ¶
type Symbol struct {
Kind Kind
Name string //
Index int // address of symbol in frame
PkgPath string //
Type *vm.Type //
Value vm.Value //
Cval constant.Value //
Used bool //
Captured bool // true if this variable escapes to a heap cell
LoopVar bool // true if this is a for-init or range variable (snapshot capture)
CellSlot bool // true if the local frame slot holds a heap cell pointer (promoted)
FreeVars []string // closure: scoped names of captured outer-scope locals, in Heap order
RecvName string // for methods: raw receiver variable name
InNames []string // raw input param names, cached from Phase 1 for Phase 2
OutNames []string // raw output param names, cached from Phase 1 for Phase 2
MethodExpr bool // true if this is a method expression (Type.Method)
Composite bool // true if this symbol is a composite literal value (T{})
NoFnew bool // true if this Type-kind stack entry was pushed without an Fnew emit (T(x), T.M, etc.); consumers must skip removeFnew
// FieldOffset and HasFieldOffset are set when this symbol is produced by a
// struct field selector chain; FieldOffset is the accumulated byte offset
// from the outermost operand to this field. Used by unsafe.Offsetof.
HasFieldOffset bool
FieldOffset uintptr
Data any // optional extra data (e.g. generic template)
Reads map[*Symbol]bool // for Func: package-level Var symbols read transitively by the body
}
Symbol structure used in parser and compiler.
func (*Symbol) FreeVarIndex ¶
FreeVarIndex returns the index of name in FreeVars, or -1 if not found.
Click to show internal directories.
Click to hide internal directories.