-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Save WhereOperand node instead of performing a scan #4795
base: trunk
Are you sure you want to change the base?
Changes from all commits
1ce2658
c312a30
096a037
e9cc59c
0094639
aa7415f
3ad9a43
0780d7e
676f2ca
5206a84
0656223
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,19 +4,23 @@ | |
|
||
#include "toolchain/check/context.h" | ||
#include "toolchain/check/handle.h" | ||
#include "toolchain/parse/typed_nodes.h" | ||
|
||
namespace Carbon::Check { | ||
|
||
auto HandleParseNode(Context& /*context*/, Parse::ParenExprStartId /*node_id*/) | ||
auto HandleParseNode(Context& context, Parse::ParenExprStartId node_id) | ||
-> bool { | ||
// The open paren is unused. | ||
// Push the start to help track nesting. | ||
context.node_stack().Push(node_id); | ||
return true; | ||
} | ||
|
||
auto HandleParseNode(Context& context, Parse::ParenExprId node_id) -> bool { | ||
// We re-push because the ParenExpr is valid for member expressions, whereas | ||
// the child expression might not be. | ||
context.node_stack().Push(node_id, context.node_stack().PopExpr()); | ||
auto expr = context.node_stack().PopExpr(); | ||
context.node_stack().PopForSoloNodeId<Parse::NodeKind::ParenExprStart>(); | ||
// We push with the ParenExpr node because it's valid for member expressions, | ||
// whereas the child expression might not be. | ||
context.node_stack().Push(node_id, expr); | ||
Comment on lines
+7
to
+23
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With the suggested change to toolchain/check/handle_impl.cpp, I think these changes should no longer be needed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this is removed, how does WhereExpr handling know when or when not to mark the If you have an approach that works without this, maybe it'd make sense to update #4772 since this PR was mainly adding the paren expr tracking on top of your work? |
||
return true; | ||
} | ||
|
||
|
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.
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.
Sorry, I'm confused by this, can you clarify why this no longer applies?