aboutsummaryrefslogtreecommitdiffstats
path: root/src/bytecode/vm.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/bytecode/vm.h')
-rwxr-xr-xsrc/bytecode/vm.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/bytecode/vm.h b/src/bytecode/vm.h
index de025c1..51a6f44 100755
--- a/src/bytecode/vm.h
+++ b/src/bytecode/vm.h
@@ -160,7 +160,17 @@ vm_interpret(VM *vm, Chunk *chunk) {
160 Object name = array_pop(vm->stack); 160 Object name = array_pop(vm->stack);
161 ht_insert(vm->globals, name, value); 161 ht_insert(vm->globals, name, value);
162 } break; 162 } break;
163 case OP_GET_GLOBAL: { 163 case OP_SET: {
164 Object value = array_pop(vm->stack);
165 Object name = array_pop(vm->stack);
166 Object *prev = ht_lookup(vm->globals, name);
167 if (prev == NULL) {
168 SYMBOL_NOT_FOUND_ERR();
169 return;
170 }
171 ht_insert(vm->globals, name, value);
172 } break;
173 case OP_GET: {
164 Object name = array_pop(vm->stack); 174 Object name = array_pop(vm->stack);
165 Object *value = ht_lookup(vm->globals, name); 175 Object *value = ht_lookup(vm->globals, name);
166 if (value == NULL) { 176 if (value == NULL) {