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

Method assignment

parser.go:319–339  ·  view source on GitHub ↗
(t *assignmentTarget, variableCount int)

Source from the content-addressed store, hash-verified

317}
318
319func (p *parser) assignment(t *assignmentTarget, variableCount int) {
320 if p.checkCondition(t.isVariable(), "syntax error"); p.testNext(',') {
321 e := p.suffixedExpression()
322 if e.kind != kindIndexed {
323 p.function.CheckConflict(t, e)
324 }
325 p.checkLimit(variableCount+p.l.nestedGoCallCount, maxCallCount, "Go levels")
326 p.assignment(&assignmentTarget{previous: t, exprDesc: e}, variableCount+1)
327 } else {
328 p.checkNext('=')
329 if e, n := p.expressionList(); n != variableCount {
330 if p.function.AdjustAssignment(variableCount, n, e); n > variableCount {
331 p.function.freeRegisterCount -= n - variableCount // remove extra values
332 }
333 } else {
334 p.function.StoreVariable(t.exprDesc, p.function.SetReturn(e))
335 return // avoid default
336 }
337 }
338 p.function.StoreVariable(t.exprDesc, makeExpression(kindNonRelocatable, p.function.freeRegisterCount-1))
339}
340
341func (p *parser) forBody(base, line, n int, isNumeric bool) {
342 p.function.AdjustLocalVariables(3)

Callers 1

expressionStatementMethod · 0.95

Calls 12

checkConditionMethod · 0.95
suffixedExpressionMethod · 0.95
checkLimitMethod · 0.95
checkNextMethod · 0.95
expressionListMethod · 0.95
makeExpressionFunction · 0.85
isVariableMethod · 0.80
testNextMethod · 0.80
CheckConflictMethod · 0.80
AdjustAssignmentMethod · 0.80
StoreVariableMethod · 0.80
SetReturnMethod · 0.80

Tested by

no test coverage detected