diff options
author | daurnimator <quae@daurnimator.com> | 2017-05-05 16:46:56 +1000 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2017-05-05 16:52:49 +1000 |
commit | b54eee30383e4eaae74551afc9d1c59126269305 (patch) | |
tree | 4902003c0ce70ac1b0b81d4b40aa144e30e61c2f | |
parent | 1dc893efcd664df86606b571d4b6bbee5b5868ca (diff) | |
download | fengari-b54eee30383e4eaae74551afc9d1c59126269305.tar.gz fengari-b54eee30383e4eaae74551afc9d1c59126269305.tar.bz2 fengari-b54eee30383e4eaae74551afc9d1c59126269305.zip |
An open upvalue already knows which lua_State it comes from
-rw-r--r-- | src/lapi.js | 2 | ||||
-rw-r--r-- | src/ldebug.js | 2 | ||||
-rw-r--r-- | src/lfunc.js | 6 | ||||
-rw-r--r-- | src/lvm.js | 6 |
4 files changed, 8 insertions, 8 deletions
diff --git a/src/lapi.js b/src/lapi.js index 2c03c39..d3e4119 100644 --- a/src/lapi.js +++ b/src/lapi.js @@ -512,7 +512,7 @@ const aux_upvalue = function(L, fi, n) { let name = p.upvalues[n-1].name; return { name: name ? name : "(*no name)", - val: f.upvals[n-1].val(L) + val: f.upvals[n-1].val() }; } default: return null; /* not a closure */ diff --git a/src/ldebug.js b/src/ldebug.js index 34c6fc5..910720f 100644 --- a/src/ldebug.js +++ b/src/ldebug.js @@ -513,7 +513,7 @@ const isinstack = function(L, ci, o) { const getupvalname = function(L, ci, o) { let c = ci.func; for (let i = 0; i < c.nupvalues; i++) { - if (c.upvals[i].val(L) === o) { + if (c.upvals[i].val() === o) { return { name: upvalname(c.p, i), funcname: defs.to_luastring('upvalue', true) diff --git a/src/lfunc.js b/src/lfunc.js index db623b5..0b78bd3 100644 --- a/src/lfunc.js +++ b/src/lfunc.js @@ -41,8 +41,8 @@ class UpVal { }; } - val(L) { - return this.v !== null ? L.stack[this.v] : this.u.value; + val() { + return this.v !== null ? this.L.stack[this.v] : this.u.value; } setval(L, ra) { @@ -94,7 +94,7 @@ const luaF_close = function(L, level) { assert(uv.isopen()); L.openupval = uv.u.open.next; /* remove from 'open' list */ if (uv.refcount > 0) { - let from = L.stack[uv.v]; + let from = uv.L.stack[uv.v]; uv.u.value = new lobject.TValue(from.type, from.value); uv.v = null; } @@ -161,7 +161,7 @@ const luaV_execute = function(L) { break; } case OCi.OP_GETUPVAL: { - let o = cl.upvals[i.B].val(L); + let o = cl.upvals[i.B].val(); L.stack[ra] = new lobject.TValue(o.type, o.value); break; } @@ -170,7 +170,7 @@ const luaV_execute = function(L) { break; } case OCi.OP_GETTABUP: { - let table = cl.upvals[i.B].val(L); + let table = cl.upvals[i.B].val(); let key = RKC(L, base, k, i); gettable(L, table, key, ra); @@ -178,7 +178,7 @@ const luaV_execute = function(L) { break; } case OCi.OP_SETTABUP: { - let table = cl.upvals[i.A].val(L); + let table = cl.upvals[i.A].val(); let key = RKB(L, base, k, i); let v = RKC(L, base, k, i); |