diff options
author | Benoit Germain <benoit.germain@ubisoft.com> | 2025-02-05 12:27:02 +0100 |
---|---|---|
committer | Benoit Germain <benoit.germain@ubisoft.com> | 2025-02-05 12:27:02 +0100 |
commit | 05e4cce366cccf92ad88f80695efa548fae187de (patch) | |
tree | 3332753154ecd89a87d7fdd6a4f9383d1b66ed1f /src/nameof.cpp | |
parent | 59ae58fd31d63c261372bd5a36765328583bc1b6 (diff) | |
download | lanes-05e4cce366cccf92ad88f80695efa548fae187de.tar.gz lanes-05e4cce366cccf92ad88f80695efa548fae187de.tar.bz2 lanes-05e4cce366cccf92ad88f80695efa548fae187de.zip |
Minor internal code tweaks
* mark all eligible classes Final
* new TableIndex strong type
* buildfixes for HAVE_DEBUGSPEW()
* overridden virtual destructors tagged as such
Diffstat (limited to 'src/nameof.cpp')
-rw-r--r-- | src/nameof.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/nameof.cpp b/src/nameof.cpp index 2ae315a..027c703 100644 --- a/src/nameof.cpp +++ b/src/nameof.cpp | |||
@@ -33,7 +33,7 @@ THE SOFTWARE. | |||
33 | 33 | ||
34 | // Return some name helping to identify an object | 34 | // Return some name helping to identify an object |
35 | [[nodiscard]] | 35 | [[nodiscard]] |
36 | static int DiscoverObjectNameRecur(lua_State* L_, int shortest_, int depth_) | 36 | static int DiscoverObjectNameRecur(lua_State* const L_, int shortest_, TableIndex depth_) |
37 | { | 37 | { |
38 | static constexpr StackIndex kWhat{ 1 }; // the object to investigate // L_: o "r" {c} {fqn} ... {?} | 38 | static constexpr StackIndex kWhat{ 1 }; // the object to investigate // L_: o "r" {c} {fqn} ... {?} |
39 | static constexpr StackIndex kResult{ 2 }; // where the result string is stored | 39 | static constexpr StackIndex kResult{ 2 }; // where the result string is stored |
@@ -193,13 +193,13 @@ LUAG_FUNC(nameof) | |||
193 | lua_rawseti(L_, -2, 1); // L_: o nil {c} {fqn} | 193 | lua_rawseti(L_, -2, 1); // L_: o nil {c} {fqn} |
194 | // this is where we start the search | 194 | // this is where we start the search |
195 | luaG_pushglobaltable(L_); // L_: o nil {c} {fqn} _G | 195 | luaG_pushglobaltable(L_); // L_: o nil {c} {fqn} _G |
196 | std::ignore = DiscoverObjectNameRecur(L_, std::numeric_limits<int>::max(), 1); | 196 | std::ignore = DiscoverObjectNameRecur(L_, std::numeric_limits<int>::max(), TableIndex{ 1 }); |
197 | if (lua_isnil(L_, 2)) { // try again with registry, just in case... | 197 | if (lua_isnil(L_, 2)) { // try again with registry, just in case... |
198 | lua_pop(L_, 1); // L_: o nil {c} {fqn} | 198 | lua_pop(L_, 1); // L_: o nil {c} {fqn} |
199 | luaG_pushstring(L_, "_R"); // L_: o nil {c} {fqn} "_R" | 199 | luaG_pushstring(L_, "_R"); // L_: o nil {c} {fqn} "_R" |
200 | lua_rawseti(L_, -2, 1); // L_: o nil {c} {fqn} | 200 | lua_rawseti(L_, -2, 1); // L_: o nil {c} {fqn} |
201 | lua_pushvalue(L_, kIdxRegistry); // L_: o nil {c} {fqn} _R | 201 | lua_pushvalue(L_, kIdxRegistry); // L_: o nil {c} {fqn} _R |
202 | std::ignore = DiscoverObjectNameRecur(L_, std::numeric_limits<int>::max(), 1); | 202 | std::ignore = DiscoverObjectNameRecur(L_, std::numeric_limits<int>::max(), TableIndex{ 1 }); |
203 | } | 203 | } |
204 | lua_pop(L_, 3); // L_: o "result" | 204 | lua_pop(L_, 3); // L_: o "result" |
205 | STACK_CHECK(L_, 1); | 205 | STACK_CHECK(L_, 1); |