-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[IDE] Don't walk to ExplicitCast expr twice in ModelASTWalker #18663
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
Conversation
@swift-ci Please smoke test |
Why are there 2 cast exprs, is this really necessary ? Are these 2 different ExplicitCastExpr* pointers or the same one showing up twice ? |
lib/IDE/SyntaxModel.cpp
Outdated
for(unsigned i = 0, e = SE->getElements().size(); i != e; ++i) { | ||
auto subExpr = SE->getElement(i); | ||
|
||
if (i % 2 != 0 && isa<ExplicitCastExpr>(subExpr)) |
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.
If the pointer for the expression appears twice, can we use a pointer set here to exclude duplications? or do we actually create the same expression twice?
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.
That's a good idea. 👍
They are the 2 pointers to the same object. I think we can make not showing up 2 times, but it need non trivial changes to the pipeline. |
I suspect this is to make the even/odd aspect of SequenceExpr work. |
Yeah, but I think we can make it like |
596905c
to
eb7d924
Compare
Explict cast expressions (i.e. 'as', 'as!`, 'as?', and 'is') appear twice in 'SequenceExpr'. For instance, 'a as B' is parsed as: (sequence_expr (unresolved_declref_expr name='a') (coerce_expr writtenType='B') (coerce_expr writtenType='B')) This patch prevents ModelASTWalker from walking into them twice. rdar://problem/43135727
eb7d924
to
fedc36e
Compare
@swift-ci Please smoke test |
Explicit cast expressions (i.e.
as
,as!
,as?
, andis
) appear twice inSequenceExpr
. For instance,a as B
is parsed as:This patch prevents
ModelASTWalker
from walking into them twice.rdar://problem/43135727