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

Method pushCallFrame

state.go:1132–1244  ·  view source on GitHub ↗

+inline-end

(cf callFrame, fn LValue, meta bool)

Source from the content-addressed store, hash-verified

1130} // +inline-end
1131
1132func (ls *LState) pushCallFrame(cf callFrame, fn LValue, meta bool) { // +inline-start
1133 if meta {
1134 cf.NArgs++
1135 ls.reg.Insert(fn, cf.LocalBase)
1136 }
1137 if cf.Fn == nil {
1138 ls.RaiseError("attempt to call a non-function object")
1139 }
1140 if ls.stack.IsFull() {
1141 ls.RaiseError("stack overflow")
1142 }
1143 ls.stack.Push(cf)
1144 newcf := ls.stack.Last()
1145 // this section is inlined by go-inline
1146 // source function is 'func (ls *LState) initCallFrame(cf *callFrame) ' in '_state.go'
1147 {
1148 cf := newcf
1149 if cf.Fn.IsG {
1150 ls.reg.SetTop(cf.LocalBase + cf.NArgs)
1151 } else {
1152 proto := cf.Fn.Proto
1153 nargs := cf.NArgs
1154 np := int(proto.NumParameters)
1155 if nargs < np {
1156 // default any missing arguments to nil
1157 newSize := cf.LocalBase + np
1158 // this section is inlined by go-inline
1159 // source function is 'func (rg *registry) checkSize(requiredSize int) ' in '_state.go'
1160 {
1161 rg := ls.reg
1162 requiredSize := newSize
1163 if requiredSize > cap(rg.array) {
1164 rg.resize(requiredSize)
1165 }
1166 }
1167 for i := nargs; i < np; i++ {
1168 ls.reg.array[cf.LocalBase+i] = LNil
1169 }
1170 nargs = np
1171 ls.reg.top = newSize
1172 }
1173
1174 if (proto.IsVarArg & VarArgIsVarArg) == 0 {
1175 if nargs < int(proto.NumUsedRegisters) {
1176 nargs = int(proto.NumUsedRegisters)
1177 }
1178 newSize := cf.LocalBase + nargs
1179 // this section is inlined by go-inline
1180 // source function is 'func (rg *registry) checkSize(requiredSize int) ' in '_state.go'
1181 {
1182 rg := ls.reg
1183 requiredSize := newSize
1184 if requiredSize > cap(rg.array) {
1185 rg.resize(requiredSize)
1186 }
1187 }
1188 for i := np; i < nargs; i++ {
1189 ls.reg.array[cf.LocalBase+i] = LNil

Callers 3

callRMethod · 0.95
initFunction · 0.45
initFunction · 0.45

Calls 12

RaiseErrorMethod · 0.95
newLTableFunction · 0.85
LNumberTypeAlias · 0.85
RawSetStringMethod · 0.80
IsFullMethod · 0.65
PushMethod · 0.65
LastMethod · 0.65
InsertMethod · 0.45
SetTopMethod · 0.45
resizeMethod · 0.45
RawSetIntMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected