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

Method functionArguments

parser.go:100–131  ·  view source on GitHub ↗
(f exprDesc, line int)

Source from the content-addressed store, hash-verified

98}
99
100func (p *parser) functionArguments(f exprDesc, line int) exprDesc {
101 var args exprDesc
102 switch p.t {
103 case '(':
104 p.next()
105 if p.t == ')' {
106 args.kind = kindVoid
107 } else {
108 args, _ = p.expressionList()
109 p.function.SetMultipleReturns(args)
110 }
111 p.checkMatch(')', '(', line)
112 case '{':
113 args = p.constructor()
114 case tkString:
115 args = p.function.EncodeString(p.s)
116 p.next()
117 default:
118 p.syntaxError("function arguments expected")
119 }
120 base, parameterCount := f.info, MultipleReturns
121 if !args.hasMultipleReturns() {
122 if args.kind != kindVoid {
123 args = p.function.ExpressionToNextRegister(args)
124 }
125 parameterCount = p.function.freeRegisterCount - (base + 1)
126 }
127 e := makeExpression(kindCall, p.function.EncodeABC(opCall, base, parameterCount+1, 2))
128 p.function.FixLine(line)
129 p.function.freeRegisterCount = base + 1 // call removed function and args & leaves (unless changed) one result
130 return e
131}
132
133func (p *parser) primaryExpression() (e exprDesc) {
134 switch p.t {

Callers 1

suffixedExpressionMethod · 0.95

Calls 12

expressionListMethod · 0.95
constructorMethod · 0.95
hasMultipleReturnsMethod · 0.95
makeExpressionFunction · 0.85
SetMultipleReturnsMethod · 0.80
checkMatchMethod · 0.80
EncodeStringMethod · 0.80
syntaxErrorMethod · 0.80
EncodeABCMethod · 0.80
FixLineMethod · 0.80
nextMethod · 0.45

Tested by

no test coverage detected