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; }