From b271ce1d9098c9057fccdca6eba6b0ee0a5245a2 Mon Sep 17 00:00:00 2001 From: Bad Diode Date: Sat, 23 Oct 2021 19:47:50 +0200 Subject: Change relevant OPs to use list operations --- src/bytecode/compiler.h | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'src/bytecode/compiler.h') diff --git a/src/bytecode/compiler.h b/src/bytecode/compiler.h index 6f43416..7a25678 100755 --- a/src/bytecode/compiler.h +++ b/src/bytecode/compiler.h @@ -80,21 +80,15 @@ compile_list_binary_op(Chunk *chunk, Visitor *vs, Token list_start, Ops op) { .line = list_start.line, .col = list_start.column, }); + return; } - return; + break; } parse_tree(chunk, vs); n++; - if (n > 1) { - add_code(chunk, op, list_start.line, list_start.column); - } } - error_push((Error){ - .type = ERR_TYPE_COMPILER, - .value = ERR_NOT_ENOUGH_ARGS, - .line = list_start.line, - .col = list_start.column, - }); + emit_constant(chunk, list_start, FIXNUM_VAL(n)); + add_code(chunk, op, list_start.line, list_start.column); } void -- cgit v1.2.1