[Date Prev][Date Next][Thread Prev][Thread Next]
- 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
constant folding now passes a lua_State* to luaO_arith.
I don't think this is desired: should that commit be backed out?