MCPcopy Index your code
hub / github.com/yuin/gopher-lua / compileFuncDefStmt

Function compileFuncDefStmt

compile.go:1034–1048  ·  view source on GitHub ↗

}}}

(context *funcContext, stmt *ast.FuncDefStmt)

Source from the content-addressed store, hash-verified

1032} // }}}
1033
1034func compileFuncDefStmt(context *funcContext, stmt *ast.FuncDefStmt) { // {{{
1035 if stmt.Name.Func == nil {
1036 reg := context.RegTop()
1037 var treg, kreg int
1038 compileExprWithKMVPropagation(context, stmt.Name.Receiver, &reg, &treg)
1039 kreg = loadRk(context, &reg, stmt.Func, LString(stmt.Name.Method))
1040 compileExpr(context, reg, stmt.Func, ecfuncdef)
1041 context.Code.AddABC(OP_SETTABLE, treg, kreg, reg, sline(stmt.Name.Receiver))
1042 } else {
1043 astmt := &ast.AssignStmt{Lhs: []ast.Expr{stmt.Name.Func}, Rhs: []ast.Expr{stmt.Func}}
1044 astmt.SetLine(sline(stmt.Func))
1045 astmt.SetLastLine(eline(stmt.Func))
1046 compileAssignStmt(context, astmt)
1047 }
1048} // }}}
1049
1050func compileNumberForStmt(context *funcContext, stmt *ast.NumberForStmt) { // {{{
1051 code := context.Code

Callers 1

compileStmtFunction · 0.85

Calls 11

loadRkFunction · 0.85
LStringTypeAlias · 0.85
compileExprFunction · 0.85
slineFunction · 0.85
elineFunction · 0.85
compileAssignStmtFunction · 0.85
RegTopMethod · 0.80
AddABCMethod · 0.80
SetLineMethod · 0.65
SetLastLineMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…