aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lvm.js2
-rw-r--r--tests/test-suite/inprogress/coroutine.js10
2 files changed, 6 insertions, 6 deletions
diff --git a/src/lvm.js b/src/lvm.js
index 4d3d5fb..56be558 100644
--- a/src/lvm.js
+++ b/src/lvm.js
@@ -43,7 +43,7 @@ const luaV_finishOp = function(L) {
if (ci.callstatus & lstate.CIST_LEQ) { /* "<=" using "<" instead? */
assert(op === OCi.OP_LE);
ci.callstatus ^= lstate.CIST_LEQ; /* clear mark */
- res = res !== 1 ? 1 : 0; /* negate result */
+ res = !res; /* negate result */
}
assert(ci.l_code[ci.l_savedpc].opcode === OCi.OP_JMP);
if (res !== (inst.A ? true : false)) /* condition failed? */
diff --git a/tests/test-suite/inprogress/coroutine.js b/tests/test-suite/inprogress/coroutine.js
index 1fe25a5..1791a32 100644
--- a/tests/test-suite/inprogress/coroutine.js
+++ b/tests/test-suite/inprogress/coroutine.js
@@ -767,6 +767,11 @@ test("[test-suite] coroutine: testing yields inside metamethods", function (t) {
assert(run(function() return "a" .. "b" .. a .. "c" .. c .. b .. "x" end,
{"concat", "concat", "concat"}) == "ab10chello12x")
+
+ assert(run(function ()
+ a.BB = print
+ return a.BB
+ end, {"nidx", "idx"}) == print)
`, L;
t.plan(2);
@@ -831,11 +836,6 @@ test("[test-suite] coroutine: tests for comparsion operators", function (t) {
run(test)
end
-
- assert(run(function ()
- a.BB = print
- return a.BB
- end, {"nidx", "idx"}) == print)
`, L;
t.plan(2);