diff options
Diffstat (limited to 'compiler.d')
| -rw-r--r-- | compiler.d | 19 |
1 files changed, 7 insertions, 12 deletions
@@ -7,11 +7,6 @@ import parser; import chunk; import dbg; -enum FunctionType { - FUNCTION, - SCRIPT, -} - struct Local { Symbol sym; int depth; @@ -20,7 +15,6 @@ struct Local { class Compiler { Function func; - FunctionType type; Parser* parser; Local[] locals; int localCount; @@ -369,15 +363,16 @@ class Compiler { Function finish() { this.func.chunk.writeOp(OpCode.OP_RETURN, current.line); + disassembleChunk(func.chunk, to!string(func)); return func; } - this(FunctionType type, Parser* parser) { + this(ObjType type, Parser* parser) { this.parser = parser; - this.func = new Function(); - this.type = type; - localCount = 0; - //locals ~= Local(new Symbol("", -1), 0); - //localCount++; + this.func = new Function(type); + //localCount = 0; + + locals ~= Local(new Symbol("", -1), 0); + localCount++; } } |
