summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Giannangeli <giann008@gmail.com>2017-04-24 08:50:48 +0200
committerBenoit Giannangeli <giann008@gmail.com>2017-04-24 11:18:25 +0200
commitd15e00af0798783bdce5e27d2ab43de3ecb3fa4e (patch)
treed8ba199f3b198413fa75d492a2820b8fb304f2de
parent1094adc81e7f46720e9ef269f43fc265475cddf7 (diff)
downloadfengari-d15e00af0798783bdce5e27d2ab43de3ecb3fa4e.tar.gz
fengari-d15e00af0798783bdce5e27d2ab43de3ecb3fa4e.tar.bz2
fengari-d15e00af0798783bdce5e27d2ab43de3ecb3fa4e.zip
L.openupval was not set in luaF_close
-rw-r--r--README.md4
-rw-r--r--src/lfunc.js4
-rw-r--r--src/lstate.js4
-rw-r--r--tests/ldblib.js2
4 files changed, 7 insertions, 7 deletions
diff --git a/README.md b/README.md
index c19a20b..dde8598 100644
--- a/README.md
+++ b/README.md
@@ -59,8 +59,9 @@
- [ ] luaL_testudata
- [ ] luaL_unref
- [ ] Run [Lua test suite](https://github.com/lua/tests)
- - [x] strings.lua
- [x] constructs.lua (`_soft`)
+ - [x] locals.lua (`_soft`)
+ - [x] strings.lua
- [ ] all.lua
- [ ] big.lua
- [ ] checktable.lua
@@ -76,7 +77,6 @@
- [ ] coroutine.lua
- [ ] events.lua
- [ ] goto.lua
- - [ ] locals.lua
- [ ] nextvar.lua
- [ ] vararg.lua
- [ ] attrib.lua
diff --git a/src/lfunc.js b/src/lfunc.js
index bde96d7..3f8fe2d 100644
--- a/src/lfunc.js
+++ b/src/lfunc.js
@@ -81,7 +81,7 @@ const findupval = function(L, level) {
uv.u.open.next = pp;
uv.u.open.touched = true;
- pp = uv;
+ L.openupval = uv;
uv.v = level;
@@ -96,7 +96,7 @@ const luaF_close = function(L, level) {
assert(uv.isopen());
L.openupval = uv.u.open.next; /* remove from 'open' list */
if (uv.refcount > 0) {
- uv.value = L.stack[uv.v];
+ uv.u.value = L.stack[uv.v];
uv.v = null;
}
}
diff --git a/src/lstate.js b/src/lstate.js
index d95889b..5842562 100644
--- a/src/lstate.js
+++ b/src/lstate.js
@@ -50,7 +50,7 @@ class lua_State extends lobject.TValue {
this.ci = null;
this.ciOff = null;
this.stack = [];
- this.openupval = [];
+ this.openupval = null;
this.status = TS.LUA_OK;
this.next = null;
this.twups = [this];
@@ -138,7 +138,7 @@ const preinit_thread = function(L, g) {
L.basehookcount = 0;
L.allowhook = 1;
L.hookcount = L.basehookcount;
- L.openupval = [];
+ L.openupval = null;
L.nny = 1;
L.status = TS.LUA_OK;
L.errfunc = 0;
diff --git a/tests/ldblib.js b/tests/ldblib.js
index 6587228..8913642 100644
--- a/tests/ldblib.js
+++ b/tests/ldblib.js
@@ -44,7 +44,7 @@ test('debug.sethook', function (t) {
t.strictEqual(
lapi.lua_tojsstring(L, -1),
- "return count line count line count line count return count line count line count return count line count line count return count line return ",
+ "return count line count line count line count return count line count line count return count line count line count return count line ",
"Correct element(s) on the stack"
);