lua

A copy of the Lua development repository
Log | Files | Refs | README

commit 643188d6e58dfd3270d689230867289347260b74
parent 3df5624ff432b340fe122988fe6d025ad3217946
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Tue, 27 Aug 2019 10:27:42 -0300

Fixed missing case in 'luaV_finishOp'

A metamethod call like '1 << a' was not being properly resumed
if it got yielded.

Diffstat:
Mlvm.c | 2+-
Mtestes/coroutine.lua | 6++++++
2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/lvm.c b/lvm.c @@ -727,7 +727,7 @@ void luaV_finishOp (lua_State *L) { case OP_MUL: case OP_DIV: case OP_IDIV: case OP_BANDK: case OP_BORK: case OP_BXORK: case OP_BAND: case OP_BOR: case OP_BXOR: - case OP_SHRI: case OP_SHL: case OP_SHR: + case OP_SHLI: case OP_SHRI: case OP_SHL: case OP_SHR: case OP_MOD: case OP_POW: case OP_UNM: case OP_BNOT: case OP_LEN: case OP_GETTABUP: case OP_GETTABLE: case OP_GETI: diff --git a/testes/coroutine.lua b/testes/coroutine.lua @@ -747,6 +747,12 @@ assert(run(function () return a >> b end, {"shr"}) == 10 >> 12) assert(run(function () return 10 & b end, {"band"}) == 10 & 12) assert(run(function () return a | 2 end, {"bor"}) == 10 | 2) assert(run(function () return a ~ 2 end, {"bxor"}) == 10 ~ 2) +assert(run(function () return a >> 2 end, {"shr"}) == 10 >> 2) +assert(run(function () return 1 >> a end, {"shr"}) == 1 >> 10) +assert(run(function () return a << 2 end, {"shl"}) == 10 << 2) +assert(run(function () return 1 << a end, {"shl"}) == 1 << 10) +assert(run(function () return a ~ 2 end, {"bxor"}) == 10 ~ 2) + assert(run(function () return a..b end, {"concat"}) == "1012")