compile spacey function calls too
This commit is contained in:
parent
12370361c4
commit
dcf94296fa
|
|
@ -482,6 +482,7 @@ export class Compiler {
|
||||||
PUSH 1 ; Named count
|
PUSH 1 ; Named count
|
||||||
CALL
|
CALL
|
||||||
*/
|
*/
|
||||||
|
case terms.FunctionCallWithNewlines:
|
||||||
case terms.FunctionCall: {
|
case terms.FunctionCall: {
|
||||||
const { identifierNode, namedArgs, positionalArgs } = getFunctionCallParts(node, input)
|
const { identifierNode, namedArgs, positionalArgs } = getFunctionCallParts(node, input)
|
||||||
const instructions: ProgramItem[] = []
|
const instructions: ProgramItem[] = []
|
||||||
|
|
@ -863,7 +864,7 @@ export class Compiler {
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new CompilerError(
|
throw new CompilerError(
|
||||||
`Compiler doesn't know how to handle a "${node.type.name}" node.`,
|
`Compiler doesn't know how to handle a "${node.type.name}" (${node.type.id}) node.`,
|
||||||
node.from,
|
node.from,
|
||||||
node.to
|
node.to
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -440,6 +440,26 @@ describe('Parentheses', () => {
|
||||||
PositionalArg
|
PositionalArg
|
||||||
Identifier arg3`)
|
Identifier arg3`)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('function call with mulitline identifiers starting separate lines in parens', () => {
|
||||||
|
expect(`(
|
||||||
|
|
||||||
|
echo
|
||||||
|
arg1
|
||||||
|
arg2
|
||||||
|
arg3
|
||||||
|
|
||||||
|
)`).toMatchTree(`
|
||||||
|
ParenExpr
|
||||||
|
FunctionCall
|
||||||
|
Identifier echo
|
||||||
|
PositionalArg
|
||||||
|
Identifier arg1
|
||||||
|
PositionalArg
|
||||||
|
Identifier arg2
|
||||||
|
PositionalArg
|
||||||
|
Identifier arg3`)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('Number literals', () => {
|
describe('Number literals', () => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user