Skip to content

Fix #601: Passing chaiscript::ChaiScript reference to add_class for enumerations#686

Merged
lefticus merged 1 commit intoChaiScript:developfrom
leftibot:fix/issue-601-passing-chaiscript-chaiscript-reference-
Apr 14, 2026
Merged

Fix #601: Passing chaiscript::ChaiScript reference to add_class for enumerations#686
lefticus merged 1 commit intoChaiScript:developfrom
leftibot:fix/issue-601-passing-chaiscript-chaiscript-reference-

Conversation

@leftibot
Copy link
Copy Markdown
Contributor

Automated fix by @leftibot.

What changed

Fix #601: Allow operator functions to accept any type with an add() method
The operator functions in chaiscript::bootstrap::operators (equal, not_equal,
assign, etc.) hardcoded Module& as their first parameter, preventing
chaiscript::utility::add_class for enum types from working when passed a
ChaiScript& reference directly. Added a second template parameter ModuleType
to all operator functions so they accept any type that provides an add()
method, matching the already-templatized add_class functions in utility.hpp.
Co-Authored-By: Claude Opus 4.6 (1M context) [email protected]

Files

 include/chaiscript/dispatchkit/operators.hpp | 132 +++++++++++++--------------
 unittests/compiled_tests.cpp                 |  39 ++++++++
 2 files changed, 105 insertions(+), 66 deletions(-)

Closes #601

Triggered by @lefticus.

…an add() method

The operator functions in chaiscript::bootstrap::operators (equal, not_equal,
assign, etc.) hardcoded Module& as their first parameter, preventing
chaiscript::utility::add_class for enum types from working when passed a
ChaiScript& reference directly. Added a second template parameter ModuleType
to all operator functions so they accept any type that provides an add()
method, matching the already-templatized add_class functions in utility.hpp.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@lefticus lefticus merged commit e61be76 into ChaiScript:develop Apr 14, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Passing chaiscript::ChaiScript reference to add_class for enumerations

2 participants