aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-08-27 10:28:09 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-08-27 10:28:09 -0300
commit643188d6e58dfd3270d689230867289347260b74 (patch)
treeda7fc432f23d07ddaf02e91bda6bc3e5fa67952d
parent3df5624ff432b340fe122988fe6d025ad3217946 (diff)
downloadlua-643188d6e58dfd3270d689230867289347260b74.tar.gz
lua-643188d6e58dfd3270d689230867289347260b74.tar.bz2
lua-643188d6e58dfd3270d689230867289347260b74.zip
Fixed missing case in 'luaV_finishOp'
A metamethod call like '1 << a' was not being properly resumed if it got yielded.
-rw-r--r--lvm.c2
-rw-r--r--testes/coroutine.lua6
2 files changed, 7 insertions, 1 deletions
diff --git a/lvm.c b/lvm.c
index 303954f0..907417e3 100644
--- a/lvm.c
+++ b/lvm.c
@@ -727,7 +727,7 @@ void luaV_finishOp (lua_State *L) {
727 case OP_MUL: case OP_DIV: case OP_IDIV: 727 case OP_MUL: case OP_DIV: case OP_IDIV:
728 case OP_BANDK: case OP_BORK: case OP_BXORK: 728 case OP_BANDK: case OP_BORK: case OP_BXORK:
729 case OP_BAND: case OP_BOR: case OP_BXOR: 729 case OP_BAND: case OP_BOR: case OP_BXOR:
730 case OP_SHRI: case OP_SHL: case OP_SHR: 730 case OP_SHLI: case OP_SHRI: case OP_SHL: case OP_SHR:
731 case OP_MOD: case OP_POW: 731 case OP_MOD: case OP_POW:
732 case OP_UNM: case OP_BNOT: case OP_LEN: 732 case OP_UNM: case OP_BNOT: case OP_LEN:
733 case OP_GETTABUP: case OP_GETTABLE: case OP_GETI: 733 case OP_GETTABUP: case OP_GETTABLE: case OP_GETI:
diff --git a/testes/coroutine.lua b/testes/coroutine.lua
index 26ed1f6a..48f4c5bf 100644
--- a/testes/coroutine.lua
+++ b/testes/coroutine.lua
@@ -747,6 +747,12 @@ assert(run(function () return a >> b end, {"shr"}) == 10 >> 12)
747assert(run(function () return 10 & b end, {"band"}) == 10 & 12) 747assert(run(function () return 10 & b end, {"band"}) == 10 & 12)
748assert(run(function () return a | 2 end, {"bor"}) == 10 | 2) 748assert(run(function () return a | 2 end, {"bor"}) == 10 | 2)
749assert(run(function () return a ~ 2 end, {"bxor"}) == 10 ~ 2) 749assert(run(function () return a ~ 2 end, {"bxor"}) == 10 ~ 2)
750assert(run(function () return a >> 2 end, {"shr"}) == 10 >> 2)
751assert(run(function () return 1 >> a end, {"shr"}) == 1 >> 10)
752assert(run(function () return a << 2 end, {"shl"}) == 10 << 2)
753assert(run(function () return 1 << a end, {"shl"}) == 1 << 10)
754assert(run(function () return a ~ 2 end, {"bxor"}) == 10 ~ 2)
755
750 756
751assert(run(function () return a..b end, {"concat"}) == "1012") 757assert(run(function () return a..b end, {"concat"}) == "1012")
752 758