diff options
Diffstat (limited to 'src/bytecode/main.c')
-rw-r--r-- | src/bytecode/main.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/bytecode/main.c b/src/bytecode/main.c index ce196c8..c994e08 100644 --- a/src/bytecode/main.c +++ b/src/bytecode/main.c | |||
@@ -32,12 +32,13 @@ process_source(const StringView *source) { | |||
32 | Chunk chunk = {0}; | 32 | Chunk chunk = {0}; |
33 | array_init(chunk.code, 0); | 33 | array_init(chunk.code, 0); |
34 | array_init(chunk.constants, 0); | 34 | array_init(chunk.constants, 0); |
35 | array_init(chunk.lines, 0); | ||
35 | 36 | ||
36 | // Push some test instructions. | 37 | // Push some test instructions. |
37 | size_t const_idx = add_constant(chunk, 7); | 38 | size_t const_idx = add_constant(chunk, 7); |
38 | array_push(chunk.code, OP_CONSTANT); | 39 | add_code(chunk, OP_CONSTANT, 1, 1); |
39 | array_push(chunk.code, const_idx); | 40 | add_code(chunk, const_idx, 1, 1); |
40 | array_push(chunk.code, OP_RETURN); | 41 | add_code(chunk, OP_RETURN, 1, 1); |
41 | 42 | ||
42 | // Disassemble the chunk. | 43 | // Disassemble the chunk. |
43 | disassemble_chunk(chunk, "test chunk"); | 44 | disassemble_chunk(chunk, "test chunk"); |
@@ -45,6 +46,7 @@ process_source(const StringView *source) { | |||
45 | // Free chunk. | 46 | // Free chunk. |
46 | array_free(chunk.code); | 47 | array_free(chunk.code); |
47 | array_free(chunk.constants); | 48 | array_free(chunk.constants); |
49 | array_free(chunk.lines); | ||
48 | 50 | ||
49 | array_free(tokens); | 51 | array_free(tokens); |
50 | } | 52 | } |