-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[incrParse] Skip missing node in SyntaxData::getNextNode() #19951
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
588de88
to
b5b0e41
Compare
@swift-ci Please smoke test |
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.
Missing the RUN
line for the second test case. Otherwise LGTM.
@@ -0,0 +1,7 @@ | |||
class AnimationType { |
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.
You are missing the RUN
line for this test case.
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.
Oops...
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.
Well, this change doesn't fix this test case. Sorry, I will retry fixing.
The change doesn't solve the problem.
648ac00
to
7463cef
Compare
@swift-ci Please smoke test |
@ahoppen Could you re-review this? |
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.
Thanks for fixing this Rintaro! LGTM.
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.
Looking good overall. Two minor comments to add documentation that we skip over missing tokens and to make the behaviour of getNextNode
consistent with getPreviousNode
.
if (auto C = getParent()->getChild(I)) | ||
return C; | ||
if (auto C = getParent()->getChild(I)) { | ||
if (C->getRaw()->isPresent() && C->getFirstToken()) |
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 we skip over missing nodes here, I think we should do the same in getPreviousNode
. Also I think it's worth documenting that getNextNode
will return the next node that does contain a non-missing token.
} | ||
return Parent->getNextNode(); | ||
} | ||
return nullptr; | ||
} | ||
|
||
RC<SyntaxData> SyntaxData::getFirstToken() const { | ||
if (getRaw()->isToken()) { |
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.
Also here, I think it's worth adding a doc comment mentioning that we return the first non-missing token.
Taking Missing node into account confuses reusability checking in incremental parsing. rdar://problem/45215049 https://bugs.swift.org/browse/SR-8976 rdar://problem/45287031 https://bugs.swift.org/browse/SR-9006
e4dac20
to
891cca1
Compare
@swift-ci Please smoke test |
Probably we could add |
Yeah, I'm also thinking about it. |
Parser complements missing
}
as missing token for code blocks.Taking Missing node into account confuses reusability checking in incremental parsing.
rdar://problem/45215049 https://bugs.swift.org/browse/SR-8976
rdar://problem/45287031 https://bugs.swift.org/browse/SR-9006