From 273adc90eb00f3b547de367836bc9699b4fef580 Mon Sep 17 00:00:00 2001 From: cozis Date: Tue, 2 Nov 2021 13:24:52 +0000 Subject: [PATCH] bug fix --- samples/func.noja | 5 +++++ src/compiler/compile.c | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/samples/func.noja b/samples/func.noja index 55cc24a..75913d2 100644 --- a/samples/func.noja +++ b/samples/func.noja @@ -1,4 +1,9 @@ +fun x(a, b, c) + print(a, b, c); + +print(x(1, 2, 3)); + fun hello() print('hel\nlo', 2); diff --git a/src/compiler/compile.c b/src/compiler/compile.c index 7a71aa0..72e1334 100644 --- a/src/compiler/compile.c +++ b/src/compiler/compile.c @@ -324,7 +324,8 @@ static _Bool emit_instr_for_node(ExeBuilder *exeb, Node *node, Error *error) if(!ExeBuilder_Append(exeb, error, OPCODE_POP, &op, 1, arg->base.offset, arg->base.length)) return 0; - assert(arg->base.next->kind == NODE_ARG); + if(arg->base.next) + assert(arg->base.next->kind == NODE_ARG); arg = (ArgumentNode*) arg->base.next; }