diff options
| -rw-r--r-- | dbg.d | 2 | ||||
| -rw-r--r-- | vm.d | 3 |
2 files changed, 4 insertions, 1 deletions
@@ -82,6 +82,8 @@ string printableValue(Value val) { return printableFunction(val.as.obj); case ValueType.TYPE: return val.as.type; + case ValueType.NIL: + return "nil"; default: return "! unknown value type !"; } @@ -223,7 +223,6 @@ class VM { InterpretResult run() { writeln("== VM running =="); - writefln("> > > framecount: %d", this.frameCount); while (true) { if (DEBUG) { writeln(" Stacks:"); @@ -264,6 +263,8 @@ class VM { } Value val = this.popA(); this.globals[asString(name)] = val; + Value nil = { ValueType.NIL }; + this.pushA(nil); break; case OpCode.OP_GET_GLOBAL: Value name = this.current.func.chunk.constants[this.readByte()]; |
