[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: 'constfolding' passes a proper Lua state to 'luaO_arith'
- From: Daurnimator <quae@...>
- Date: Wed, 24 May 2017 16:19:53 +1000
- constant folding (in lcode.c) uses luaO_arith with a result on the C stack
- luaO_arith falls back to metamethods using luaT_trybinTM.
- luaT_trybinTM assumes that the result goes onto the Lua stack
To help catch errors in this arrangement, there is an assert in luaO_arith:
lua_assert(L != NULL); /* should not fail when folding (compile time) */
However, in this commit
https://github.com/lua/lua/commit/99ac4a260fc1bf958515c1816d866852194493f2
constant folding now passes a lua_State* to luaO_arith.
I don't think this is desired: should that commit be backed out?