(f exprDesc, line int)
| 98 | } |
| 99 | |
| 100 | func (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 | |
| 133 | func (p *parser) primaryExpression() (e exprDesc) { |
| 134 | switch p.t { |
no test coverage detected