-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix bugs in translation of PM_RESCUE_NODE
#317
Conversation
60a579b
to
648e0f1
Compare
PM_RESCUE_NODE
PM_RESCUE_NODE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a blocker, but maybe we can also test these cases?
begin
rescue Foo => e
end
begin
"something"
rescue Foo => e
end
2cdea4e
to
c24cdd7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really interesting find, great work
@@ -1639,7 +1641,7 @@ unique_ptr<parser::Node> Translator::translateStatements(pm_statements_node *stm | |||
// Usually returns the `SorbetLHSNode`, but for constant writes and targets, | |||
// it can can return an `LVarLhs` as a workaround in the case of a dynamic constant assignment. | |||
template <typename PrismLhsNode, typename SorbetLHSNode> | |||
unique_ptr<parser::Node> Translator::translateConst(PrismLhsNode *node) { | |||
unique_ptr<parser::Node> Translator::translateConst(PrismLhsNode *node, bool skipDynamicConstantWorkaround) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a blurb to the function docs that explains what this is (and why constant path op assignments need it)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@amomchilov Let me know what you think of the explanation above!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
7f71bc9
to
576c29c
Compare
Only do the dynamic constant assignment workaround when translating a constant from a `PM_CONSTANT_WRITE_NODE` and `PM_CONSTANT_PATH_NODE`.
576c29c
to
fcc8a72
Compare
Related to #316
Motivation
Easiest to read each commit separately.
This PR addresses some issues with
PM_RESCUE_NODE
:translateConst
, rather than just the ones that actually handle constant assignment.Test plan
See included automated tests.