aboutsummaryrefslogtreecommitdiff
path: root/src/intercopycontext.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/intercopycontext.cpp')
-rw-r--r--src/intercopycontext.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/intercopycontext.cpp b/src/intercopycontext.cpp
index 6a26018..e2e3d31 100644
--- a/src/intercopycontext.cpp
+++ b/src/intercopycontext.cpp
@@ -257,7 +257,7 @@ void InterCopyContext::copy_func() const
257 * Lua5.2 and Lua5.3: one of the upvalues is _ENV, which we don't want to copy! 257 * Lua5.2 and Lua5.3: one of the upvalues is _ENV, which we don't want to copy!
258 * instead, the function shall have LUA_RIDX_GLOBALS taken in the destination state! 258 * instead, the function shall have LUA_RIDX_GLOBALS taken in the destination state!
259 */ 259 */
260 int n{ 0 }; 260 int _n{ 0 };
261 { 261 {
262 InterCopyContext _c{ U, L2, L1, L2_cache_i, {}, VT::NORMAL, mode, {} }; 262 InterCopyContext _c{ U, L2, L1, L2_cache_i, {}, VT::NORMAL, mode, {} };
263#if LUA_VERSION_NUM >= 502 263#if LUA_VERSION_NUM >= 502
@@ -266,7 +266,7 @@ void InterCopyContext::copy_func() const
266 // -> if we encounter an upvalue equal to the global table in the source, bind it to the destination's global table 266 // -> if we encounter an upvalue equal to the global table in the source, bind it to the destination's global table
267 lua_pushglobaltable(L1); // L1: ... _G 267 lua_pushglobaltable(L1); // L1: ... _G
268#endif // LUA_VERSION_NUM 268#endif // LUA_VERSION_NUM
269 for (n = 0; (_c.name = lua_getupvalue(L1, L1_i, 1 + n)) != nullptr; ++n) { // L1: ... _G up[n] 269 for (_n = 0; (_c.name = lua_getupvalue(L1, L1_i, 1 + _n)) != nullptr; ++_n) { // L1: ... _G up[n]
270 DEBUGSPEW_CODE(fprintf(stderr, INDENT_BEGIN "UPNAME[%d]: %s -> " INDENT_END(U), n, _c.name)); 270 DEBUGSPEW_CODE(fprintf(stderr, INDENT_BEGIN "UPNAME[%d]: %s -> " INDENT_END(U), n, _c.name));
271#if LUA_VERSION_NUM >= 502 271#if LUA_VERSION_NUM >= 502
272 if (lua_rawequal(L1, -1, -2)) { // is the upvalue equal to the global table? 272 if (lua_rawequal(L1, -1, -2)) { // is the upvalue equal to the global table?
@@ -292,13 +292,13 @@ void InterCopyContext::copy_func() const
292 STACK_CHECK(L1, 0); 292 STACK_CHECK(L1, 0);
293 293
294 // Set upvalues (originally set to 'nil' by 'lua_load') 294 // Set upvalues (originally set to 'nil' by 'lua_load')
295 for (int const _func_index{ lua_gettop(L2) - n }; n > 0; --n) { 295 for (int const _func_index{ lua_gettop(L2) - _n }; _n > 0; --_n) {
296 char const* _rc{ lua_setupvalue(L2, _func_index, n) }; // L2: ... {cache} ... function 296 [[maybe_unused]] char const* _upname{ lua_setupvalue(L2, _func_index, _n) }; // L2: ... {cache} ... function
297 // 297 //
298 // "assigns the value at the top of the stack to the upvalue and returns its name. 298 // "assigns the value at the top of the stack to the upvalue and returns its name.
299 // It also pops the value from the stack." 299 // It also pops the value from the stack."
300 300
301 LUA_ASSERT(L1, _rc); // not having enough slots? 301 LUA_ASSERT(L1, _upname); // not having enough slots?
302 } 302 }
303 // once all upvalues have been set we are left 303 // once all upvalues have been set we are left
304 // with the function at the top of the stack // L2: ... {cache} ... function 304 // with the function at the top of the stack // L2: ... {cache} ... function