diff --git a/src/compiler/compiler.ts b/src/compiler/compiler.ts index 6b98c1b..fe18a09 100644 --- a/src/compiler/compiler.ts +++ b/src/compiler/compiler.ts @@ -482,6 +482,7 @@ export class Compiler { PUSH 1 ; Named count CALL */ + case terms.FunctionCallWithNewlines: case terms.FunctionCall: { const { identifierNode, namedArgs, positionalArgs } = getFunctionCallParts(node, input) const instructions: ProgramItem[] = [] @@ -863,7 +864,7 @@ export class Compiler { default: 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.to ) diff --git a/src/parser/tests/basics.test.ts b/src/parser/tests/basics.test.ts index 3558b5d..1f6f1a1 100644 --- a/src/parser/tests/basics.test.ts +++ b/src/parser/tests/basics.test.ts @@ -440,6 +440,26 @@ describe('Parentheses', () => { PositionalArg 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', () => {