aboutsummaryrefslogtreecommitdiff
path: root/src/bytecode.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bytecode.c')
-rw-r--r--src/bytecode.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/bytecode.c b/src/bytecode.c
index a0b5406..9406852 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -1,5 +1,6 @@
#include "../include/bytecode.h"
#include <assert.h>
+#include <stdio.h>
void tsl_bytecode_writer_init(TslBytecodeWriter *self) {
tsl_buffer_init(&self->buffer);
@@ -17,6 +18,7 @@ void tsl_bytecode_writer_reset_register_counter(TslBytecodeWriter *self) {
TslRegister tsl_bytecode_writer_get_unique_register(TslBytecodeWriter *self) {
if(self->register_counter < INT16_MAX)
return self->register_counter++;
+ fprintf(stderr, "Error: Too many variables in the same scope\n");
return -1;
}
@@ -28,7 +30,7 @@ int tsl_bytecode_writer_load_number(TslBytecodeWriter *self, TslRegister dst, do
return tsl_buffer_append(&self->buffer, &instruction, sizeof(instruction));
}
-tsl_bytecode_writer_mov_reg(TslBytecodeWriter *self, TslRegister dst, TslRegister src) {
+int tsl_bytecode_writer_mov_reg(TslBytecodeWriter *self, TslRegister dst, TslRegister src) {
TslInstructionType2 instruction;
instruction.opcode = TSL_OPCODE_MOV_REG;
instruction.dst_reg = dst;