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

Method field

parser.go:60–80  ·  view source on GitHub ↗
(tableRegister, a, h, pending int, e exprDesc)

Source from the content-addressed store, hash-verified

58}
59
60func (p *parser) field(tableRegister, a, h, pending int, e exprDesc) (int, int, int, exprDesc) {
61 freeRegisterCount := p.function.freeRegisterCount
62 hashField := func(k exprDesc) {
63 h++
64 p.checkNext('=')
65 p.function.FlushFieldToConstructor(tableRegister, freeRegisterCount, k, p.expression)
66 }
67 switch {
68 case p.t == tkName && p.lookAhead() == '=':
69 p.checkLimit(h, maxInt, "items in a constructor")
70 hashField(p.checkNameAsExpression())
71 case p.t == '[':
72 hashField(p.index())
73 default:
74 e = p.expression()
75 p.checkLimit(a, maxInt, "items in a constructor")
76 a++
77 pending++
78 }
79 return a, h, pending, e
80}
81
82func (p *parser) constructor() exprDesc {
83 pc, t := p.function.OpenConstructor()

Callers 1

constructorMethod · 0.95

Calls 7

checkNextMethod · 0.95
checkLimitMethod · 0.95
checkNameAsExpressionMethod · 0.95
indexMethod · 0.95
expressionMethod · 0.95
lookAheadMethod · 0.80

Tested by

no test coverage detected