# HG changeset patch # User Matthew Wild # Date 1274702103 -3600 # Node ID ecfa7896af35d6f44cd80d4d82e1581567f0a772 # Parent 741b953fcc5ff1369f801199b320a5fa47e5b2ce Give LFunctions a vm property diff -r 741b953fcc5f -r ecfa7896af35 lvm.js --- a/lvm.js Mon May 24 12:54:20 2010 +0100 +++ b/lvm.js Mon May 24 12:55:03 2010 +0100 @@ -260,11 +260,12 @@ return (INS_Bx(ins)-0x1FFFF); } -function LFunction(chunk, env) +function LFunction(vm, chunk, env) { function F() {}; F.prototype = chunk; var o = new F(); + o.vm = vm; o.environment = env; o.chunk = chunk; o.upvalues = []; @@ -377,7 +378,7 @@ case OP_CLOSURE: var prototype_id = INS_Bx(instruction); var chunk = frame.f.chunk.prototypes[prototype_id]; - var f = new LFunction(chunk, frame.f.environment); + var f = new LFunction(this, chunk, frame.f.environment); reg[INS_A(instruction)] = new LValue("function", f); for(var i=0;i