type Func … type WasmImport … type WasmExport … // NewFunc returns a new Func with the given name and type. // // fpos is the position of the "func" token, and npos is the position // of the name identifier. // // TODO(mdempsky): I suspect there's no need for separate fpos and // npos. func NewFunc(fpos, npos src.XPos, sym *types.Sym, typ *types.Type) *Func { … } func (f *Func) isStmt() { … } func (n *Func) copy() Node { … } func (n *Func) doChildren(do func(Node) bool) bool { … } func (n *Func) doChildrenWithHidden(do func(Node) bool) bool { … } func (n *Func) editChildren(edit func(Node) Node) { … } func (n *Func) editChildrenWithHidden(edit func(Node) Node) { … } func (f *Func) Type() *types.Type { … } func (f *Func) Sym() *types.Sym { … } func (f *Func) Linksym() *obj.LSym { … } func (f *Func) LinksymABI(abi obj.ABI) *obj.LSym { … } type Inline … type Mark … type ScopeID … const funcDupok … const funcWrapper … const funcABIWrapper … const funcNeedctxt … const funcHasDefer … const funcNilCheckDisabled … const funcInlinabilityChecked … const funcNeverReturns … const funcOpenCodedDeferDisallowed … const funcClosureResultsLost … const funcPackageInit … type SymAndPos … func (f *Func) Dupok() bool { … } func (f *Func) Wrapper() bool { … } func (f *Func) ABIWrapper() bool { … } func (f *Func) Needctxt() bool { … } func (f *Func) HasDefer() bool { … } func (f *Func) NilCheckDisabled() bool { … } func (f *Func) InlinabilityChecked() bool { … } func (f *Func) NeverReturns() bool { … } func (f *Func) OpenCodedDeferDisallowed() bool { … } func (f *Func) ClosureResultsLost() bool { … } func (f *Func) IsPackageInit() bool { … } func (f *Func) SetDupok(b bool) { … } func (f *Func) SetWrapper(b bool) { … } func (f *Func) SetABIWrapper(b bool) { … } func (f *Func) SetNeedctxt(b bool) { … } func (f *Func) SetHasDefer(b bool) { … } func (f *Func) SetNilCheckDisabled(b bool) { … } func (f *Func) SetInlinabilityChecked(b bool) { … } func (f *Func) SetNeverReturns(b bool) { … } func (f *Func) SetOpenCodedDeferDisallowed(b bool) { … } func (f *Func) SetClosureResultsLost(b bool) { … } func (f *Func) SetIsPackageInit(b bool) { … } func (f *Func) SetWBPos(pos src.XPos) { … } // IsClosure reports whether f is a function literal that captures at least one value. func (f *Func) IsClosure() bool { … } // FuncName returns the name (without the package) of the function f. func FuncName(f *Func) string { … } // PkgFuncName returns the name of the function referenced by f, with package // prepended. // // This differs from the compiler's internal convention where local functions // lack a package. This is primarily useful when the ultimate consumer of this // is a human looking at message. func PkgFuncName(f *Func) string { … } // LinkFuncName returns the name of the function f, as it will appear in the // symbol table of the final linked binary. func LinkFuncName(f *Func) string { … } // ParseLinkFuncName parsers a symbol name (as returned from LinkFuncName) back // to the package path and local symbol name. func ParseLinkFuncName(name string) (pkg, sym string, err error) { … } // Borrowed from x/mod. func modPathOK(r rune) bool { … } func escapedImportPathOK(r rune) bool { … } // splitPkg splits the full linker symbol name into package and local symbol // name. func splitPkg(name string) (pkgpath, sym string) { … } var CurFunc … // WithFunc invokes do with CurFunc and base.Pos set to curfn and // curfn.Pos(), respectively, and then restores their previous values // before returning. func WithFunc(curfn *Func, do func()) { … } func FuncSymName(s *types.Sym) string { … } // ClosureDebugRuntimeCheck applies boilerplate checks for debug flags // and compiling runtime. func ClosureDebugRuntimeCheck(clo *ClosureExpr) { … } var globClosgen … // closureName generates a new unique name for a closure within outerfn at pos. func closureName(outerfn *Func, pos src.XPos, why Op) *types.Sym { … } // NewClosureFunc creates a new Func to represent a function literal // with the given type. // // fpos the position used for the underlying ODCLFUNC and ONAME, // whereas cpos is the position used for the OCLOSURE. They're // separate because in the presence of inlining, the OCLOSURE node // should have an inline-adjusted position, whereas the ODCLFUNC and // ONAME must not. // // outerfn is the enclosing function. The returned function is // appending to pkg.Funcs. // // why is the reason we're generating this Func. It can be OCLOSURE // (for a normal function literal) or OGO or ODEFER (for wrapping a // call expression that has parameters or results). func NewClosureFunc(fpos, cpos src.XPos, why Op, typ *types.Type, outerfn *Func, pkg *Package) *Func { … } // IsFuncPCIntrinsic returns whether n is a direct call of internal/abi.FuncPCABIxxx functions. func IsFuncPCIntrinsic(n *CallExpr) bool { … } // IsIfaceOfFunc inspects whether n is an interface conversion from a direct // reference of a func. If so, it returns referenced Func; otherwise nil. // // This is only usable before walk.walkConvertInterface, which converts to an // OMAKEFACE. func IsIfaceOfFunc(n Node) *Func { … } // FuncPC returns a uintptr-typed expression that evaluates to the PC of a // function as uintptr, as returned by internal/abi.FuncPC{ABI0,ABIInternal}. // // n should be a Node of an interface type, as is passed to // internal/abi.FuncPC{ABI0,ABIInternal}. // // TODO(prattmic): Since n is simply an interface{} there is no assertion that // it is actually a function at all. Perhaps we should emit a runtime type // assertion? func FuncPC(pos src.XPos, n Node, wantABI obj.ABI) Node { … } // DeclareParams creates Names for all of the parameters in fn's // signature and adds them to fn.Dcl. // // If setNname is true, then it also sets types.Field.Nname for each // parameter. func (fn *Func) DeclareParams(setNname bool) { … }