Add class_evaluate for user-defined constant resolution#44
Merged
maedi merged 3 commits intolow-rb:mainfrom May 5, 2026
Merged
Conversation
maedi
reviewed
May 3, 2026
| using LowType::Syntax | ||
|
|
||
| def instance_evaluate(proxy:) | ||
| # Not a security risk because the code comes from a trusted source; the file that included lowtype. |
Member
There was a problem hiding this comment.
I'd like to keep this comment; developers are security conscious people and need to know I almost know what I'm doing. It can be put above the class definition line if it should now be a global message due to the multiple evals in the code now. Or go above each eval
Member
|
Can you please add a spec that tests one simple use-case that this PR fixes? A custom class? |
…o class_evaluate on NameError
maedi
approved these changes
May 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, evaluation happens in the Evaluator’s binding, which prevents proper resolution of user-defined constants (e.g.,
CustomClass). This PR addresses that limitation.Changes
class_evaluatemethod to evaluate expressions in the class contextclass_bindingthrough:evaluateevaluate_param_proxy_expressionsclass_evaluateclass_bindingis present:class_evaluatefor correct constant resolutionclass_bindingisnil:instance_evaluateImpact
closes #40