From d54e595644fcaf6756d53d368213ad3129c49327 Mon Sep 17 00:00:00 2001 From: Bad Diode Date: Mon, 25 Oct 2021 15:46:48 +0200 Subject: Add initial `fun` declaration compilation --- src/bytecode/main.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/bytecode/main.c') diff --git a/src/bytecode/main.c b/src/bytecode/main.c index e4cf643..7cb0a2a 100755 --- a/src/bytecode/main.c +++ b/src/bytecode/main.c @@ -45,27 +45,26 @@ process_source(const StringView *source) { } // Compile chunk. - Object main = compile(tokens); + Chunk *main = compile(tokens); if (errors_n != 0) { - object_free(main); + chunk_free(main); array_free(tokens); return; } #ifdef DEBUG - disassemble_chunk(main.chunk); + disassemble_chunk(main); #endif // Interpret chunk. CallFrame frame = (CallFrame){ - .procedure = main, - .pc = main.chunk->code, + .chunk = main, }; array_push(vm.frames, frame); vm_interpret(&vm); // Free resources. - object_free(main); + chunk_free(main); array_free(tokens); } -- cgit v1.2.1