diff options
Diffstat (limited to 'compiler.d')
| -rw-r--r-- | compiler.d | 20 |
1 files changed, 4 insertions, 16 deletions
@@ -510,24 +510,12 @@ class Compiler { } void compileList(Form[] args) { - List lst = new List(); - ValueType vt; - int addr; + int length = to!int(args.length); foreach (Form arg ; args) { - vt = this.resolve(arg, ValueType.ANY); - // how do we get at the address? - addr = to!int(this.func.chunk.constants.length) - 1; // this is probably often wrong - lst.addItem(addr); - this.func.chunk.writeOp(OpCode.OP_POP, arg.line); // shouldn't use the stack for this (but how?) + resolve(arg, ValueType.ANY); // resolve everything onto the stack } - - this.func.chunk.writeOp(OpCode.OP_CONSTANT, args[0].line); - int idx = this.func.chunk.addConstant(makeObjValue(lst)); - this.func.chunk.writeOp(to!ubyte(idx), args[0].line); - //return ValueType.OBJ; - - - //advance(); // ?? + this.func.chunk.writeOp(OpCode.OP_LIST, args[0].line); + this.func.chunk.writeOp(to!ubyte(length), args[0].line); } void compileFirst(Form[] args) { |
