lvm.js

changeset 24
5c9d8a65c87d
parent 23
70fc1cb387e1
child 25
9e62bc13b30d
--- a/lvm.js	Sat May 22 20:05:58 2010 +0100
+++ b/lvm.js	Sat May 22 20:07:05 2010 +0100
@@ -312,6 +312,7 @@
 				var prototype_id = INS_Bx(instruction);
 				var chunk = this.frame.f.chunk.prototypes[prototype_id];
 				var f = new LFunction(chunk, this.frame.f.environment);
+				this.frame.reg[INS_A(instruction)] = new LValue("function", f);
 				for(var i=0;i<chunk.numUpvalues;i++)
 				{
 					var upval_instruction = this.frame.f.instructions[this.frame.pc++];
@@ -327,7 +328,6 @@
 						throw "Invalid upvalue opcode following OP_CLOSURE";
 					}
 				}
-				this.frame.reg[INS_A(instruction)] = new LValue("function", f);
 				break;
 			case OP_RETURN:
 				var oldFrame = this.callstack.pop();

mercurial