Skip to content

[CodeCompleiton] Avoid walking the whole module to find the delayed func #28014

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

Merged

Conversation

rintaro
Copy link
Member

@rintaro rintaro commented Nov 1, 2019

Previously delayed parsing was performed by AST walker ParseDelayedFunctionBodies by finding "delayed" function decl from the AST of the whole module. This is not necessary. Optimize it by remembering the "delayed" function decl in PersistentParserState.

NOTE: SourceLoader stopped using this delayed parsing mechanism in d8b745d

rdar://problem/56819166

Previously delayed parsing was performed by AST walker
'ParseDelayedFunctionBodies' by finding "delayed" function decl from the AST
of the whole module. This is not necessary. Optimize it by remembering the
"delayed" function decl in 'PersistentParserState'.

NOTE: 'SourceLoader' stopped using this delayed parsing mechanism in
d8b745d

rdar://problem/56819166
@rintaro
Copy link
Member Author

rintaro commented Nov 1, 2019

This will conflict with #27981. I will rebase when either PR is merged.

@rintaro rintaro requested a review from benlangmuir November 1, 2019 18:00
@rintaro
Copy link
Member Author

rintaro commented Nov 1, 2019

@swift-ci Please smoke test

Copy link
Contributor

@benlangmuir benlangmuir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functionally this LGTM, thanks for fixing! I think we should consider renaming these delayed-decl methods though. For one thing, it's a bit confusing to have two methods named parseAbstractFunctionBodyDelayed. More generally, we have delayed parsing in general, and then we have specific delayed parsing API for code-completion, such as delayDecl, hasDelayedDecl, etc. Maybe we should rename the code-completion specific parts so it's clear when you're using them? What do you think?

@rintaro
Copy link
Member Author

rintaro commented Nov 6, 2019

Maybe we should rename the code-completion specific parts so it's clear when you're using them? What do you think?

I agree it's confusing and I think renaming them is a good idea. Let's do that in separate PR. (filed rdar://problem/56926367)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants