From dcf94296faebee0e8c4d685d4c3b0287b3d882a3 Mon Sep 17 00:00:00 2001 From: Chris Wanstrath Date: Mon, 10 Nov 2025 07:09:50 -0800 Subject: [PATCH] compile spacey function calls too --- src/compiler/compiler.ts | 3 ++- src/parser/tests/basics.test.ts | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) 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', () => {