MCPcopy Index your code
hub / github.com/Shopify/go-lua / forNumeric

Method forNumeric

parser.go:349–367  ·  view source on GitHub ↗
(name string, line int)

Source from the content-addressed store, hash-verified

347}
348
349func (p *parser) forNumeric(name string, line int) {
350 expr := func() { p.assert(p.function.ExpressionToNextRegister(p.expression()).kind == kindNonRelocatable) }
351 base := p.function.freeRegisterCount
352 p.function.MakeLocalVariable("(for index)")
353 p.function.MakeLocalVariable("(for limit)")
354 p.function.MakeLocalVariable("(for step)")
355 p.function.MakeLocalVariable(name)
356 p.checkNext('=')
357 expr()
358 p.checkNext(',')
359 expr()
360 if p.testNext(',') {
361 expr()
362 } else {
363 p.function.EncodeConstant(p.function.freeRegisterCount, p.function.NumberConstant(1))
364 p.function.ReserveRegisters(1)
365 }
366 p.forBody(base, line, 1, true)
367}
368
369func (p *parser) forList(name string) {
370 n, base := 4, p.function.freeRegisterCount

Callers 1

forStatementMethod · 0.95

Calls 10

expressionMethod · 0.95
checkNextMethod · 0.95
forBodyMethod · 0.95
MakeLocalVariableMethod · 0.80
testNextMethod · 0.80
EncodeConstantMethod · 0.80
NumberConstantMethod · 0.80
ReserveRegistersMethod · 0.80
assertMethod · 0.45

Tested by

no test coverage detected