Skip to content

[Parser] Include all AST nodes from every #if region in ParserUnit #79120

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 Feb 3, 2025

'ParserUnit' is used for analyzing syntax structures mainly in SourceKit.

Since we removed IfConfigDecl from AST, ParserUnit didn't inclue any AST in #if ... #endif regions even for active region because it used to consider all inactive. Instead, consider every region "active" and include all the AST nodes.

rdar://117387631

@rintaro rintaro force-pushed the parser-unit-ifconfig-allactive-rdar117387631 branch from 0d09f6b to e3fef8e Compare February 3, 2025 21:03
@rintaro rintaro changed the title [Parser] Include all AST nodes from every #if regions in ParserUnit [Parser] Include all AST nodes from every #if region in ParserUnit Feb 3, 2025
@rintaro
Copy link
Member Author

rintaro commented Feb 3, 2025

@swift-ci Please smoke test

Copy link
Member

@DougGregor DougGregor left a comment

Choose a reason for hiding this comment

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

The changes look fine, but... should we be deprecating this functionality in favor of swift-syntax? If there are functionality gaps, we could turn them into issues for swift-syntax or SourceKit-lsp

@bnbarham
Copy link
Contributor

bnbarham commented Feb 3, 2025

The changes look fine, but... should we be deprecating this functionality in favor of swift-syntax?

Yes, definitely - there's no missing functionality that I'm aware of today. But given it's not too difficult to keep existing clients working in this case, I'd rather leave this in for compatibility.

@rintaro rintaro force-pushed the parser-unit-ifconfig-allactive-rdar117387631 branch from fa6c027 to 5d7752a Compare February 3, 2025 23:49
@rintaro
Copy link
Member Author

rintaro commented Feb 3, 2025

@swift-ci Please smoke test

'ParserUnit' is used for analyzing syntax structures _mainly_ in
SourceKit.

Since we removed IfConfigDecl from AST, ParserUnit didn't
inclue any AST in #if ... #endif regions even for active region because
it used to consider all inactive. Instead, consider every region
"active" and include all the AST nodes.

rdar://117387631
@rintaro rintaro force-pushed the parser-unit-ifconfig-allactive-rdar117387631 branch from 5d7752a to 694e815 Compare February 4, 2025 00:22
@rintaro
Copy link
Member Author

rintaro commented Feb 4, 2025

@swift-ci Please smoke test

@rintaro rintaro enabled auto-merge February 4, 2025 00:25
@rintaro rintaro merged commit 2f42aba into swiftlang:main Feb 4, 2025
3 checks passed
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.

3 participants