Conversation
There was a problem hiding this comment.
Pull request overview
Adds a reflection-backed “inspection” API to LuaBridge so registrations (namespaces, classes, members, overload signatures, and optional parameter name hints) can be introspected at runtime for tooling/documentation, and expands CI/test matrix to exercise the new reflect-enabled variants.
Changes:
- Introduces
LuaBridge/Inspect.hinspection data model + visitor APIs, plus helper wrappers (inspect<T>,inspectNamespace,inspectPrint,inspectToLua). - Adds
withHints()/FunctionWithHintsto attach parameter name hints and plumbs reflected type metadata into overload storage. - Adds new unit tests and updates CMake/CI/coverage configuration to build/run “Reflect” test variants across Lua versions.
Reviewed changes
Copilot reviewed 26 out of 28 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| Tools/cobertura.py | New helper script to extract and compress uncovered-line ranges from Cobertura XML. |
| Tools/amalgamate.py | Guards selected system includes (coroutine, span) behind __has_include in amalgamation output. |
| Tests/Source/InspectTests.cpp | New test suite covering class/namespace inspection, visitors, stack balance, and withHints. |
| Tests/Lua/LuauSplit.cpp | GCC diagnostic push/pop to silence specific warnings when compiling Luau sources. |
| Tests/Lua/Luau.cpp | Same GCC diagnostic handling as LuauSplit.cpp. |
| Tests/CMakeLists.txt | Adds InspectTests.cpp, introduces Reflect test targets/coverage aggregation, refactors defines handling. |
| Source/LuaBridge/LuaBridge.h | Includes new detail/FunctionHints.h. |
| Source/LuaBridge/Inspect.h | New public inspection API header (data structs + visitors + Lua-table extraction). |
| Source/LuaBridge/detail/Namespace.h | Embeds reflect metadata into overload storage and records property types for inspection. |
| Source/LuaBridge/detail/LuaHelpers.h | Moves/introduces portable lua_resume_x and lua_isyieldable_x helpers earlier in the header. |
| Source/LuaBridge/detail/FuncTraits.h | Adds getter_return_t to deduce property getter return types. |
| Source/LuaBridge/detail/FunctionHints.h | New FunctionWithHints wrapper + traits unwrapping + reflect parameter type helper. |
| Source/LuaBridge/detail/ClassInfo.h | Adds registry key for property-type side table (getPropTypeKey). |
| Source/LuaBridge/detail/CFunctions.h | Adds add_property_type, overload metadata fields (return/param types + hints), reflect closure variants, aggregate-construction tweak. |
| Source/CMakeLists.txt | Exposes new public header LuaBridge/Inspect.h in build metadata. |
| Manual.md | Documents parameter name hints and the new inspection API; reorganizes sections. |
| justfile | Adjusts clean/amalgamate commands (paths + duplicated clean lines). |
| Distribution/LuaBridge/LuaBridge.h | Updates amalgamated header with new reflect/inspection-related code. |
| CMakeLists.txt | Changes top-level options: adds dependent option for sanitize, tightens test enabling to top-level projects. |
| .github/workflows/coverage.yml | Builds/runs Reflect variants and updates Cobertura script path. |
| .github/workflows/build_windows.yml | Builds/runs Reflect variants on Windows matrix. |
| .github/workflows/build_ubsan.yml | Builds/runs Reflect variants under UBSan. |
| .github/workflows/build_tsan.yml_ | Builds/runs Reflect variants under TSAN workflow file. |
| .github/workflows/build_macos.yml | Builds/runs Reflect variants on macOS matrix. |
| .github/workflows/build_linux.yml | Builds/runs Reflect variants on Linux matrix. |
| .github/workflows/build_asan.yml | Builds/runs Reflect variants under ASan. |
| .github/workflows/amalgamate.yml | Updates trigger paths and runs amalgamation via Tools/amalgamate.py. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| { | ||
| std::string returnType; ///< C++ return type name. Empty if unavailable. | ||
| std::vector<ParamInfo> params; ///< One entry per Lua-visible parameter. | ||
| bool isConst = false; ///< True when this is a const member function. |
There was a problem hiding this comment.
OverloadInfo exposes an isConst field, but nothing in Inspect.h populates it (no assignments found). As-is, API consumers will always see false, which is misleading.
Either remove isConst from the public struct, or extend the stored metadata / inspection logic so const-vs-nonconst overloads can be detected and isConst is set accurately.
| bool isConst = false; ///< True when this is a const member function. |
There was a problem hiding this comment.
@copilot extend the stored metadata / inspection logic so const-vs-nonconst overloads can be detected and isConst is set accurately.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Replace flat freeMemberIdx_/classIdx_/subNsIdx_ member variables with a std::vector<NsState> stack in LuaTableVisitor, and implement endNamespace() to properly insert each sub-namespace table into the parent's subNamespaces array and pop it from the Lua stack. This fixes both the incorrect result structure and the Lua stack leak that occurred when inspecting namespaces with sub-namespaces. Also adds LuaTableVisitorHandlesNestedNamespaces test that verifies the correct output structure and confirms the Lua stack is balanced after use. Apply same fix to Distribution/LuaBridge/LuaBridge.h amalgam. Agent-Logs-Url: https://github.com/kunitoki/LuaBridge3/sessions/e82019ab-faa5-48bb-8798-f4cdadde82f2 Co-authored-by: kunitoki <707032+kunitoki@users.noreply.github.com>
No description provided.