Skip to content
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

[ASTGen] Generate CaptureListExpr #79416

Merged
merged 2 commits into from
Feb 16, 2025

Conversation

rintaro
Copy link
Member

@rintaro rintaro commented Feb 16, 2025

Move the capture list entry construction logic to CaptureListEntry::createParsed() so that ASTGen can use it.

parameters: BridgedArrayRef(),
rightParenLoc: nil
)
result.params = nil
Copy link
Member Author

@rintaro rintaro Feb 16, 2025

Choose a reason for hiding this comment

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

Creating empty parameter list here was a mistake. generate(closureExpr:) will synthesize anonymous closure parameter list according to the $n usages.

@rintaro rintaro force-pushed the astgen-capturelistexpr branch from 5376bc1 to c6e94b6 Compare February 16, 2025 04:29
Move the capture list entry construction logic to
CaptureListEntry::createParsed() so that ASTGen can use it.
@rintaro rintaro force-pushed the astgen-capturelistexpr branch from c6e94b6 to 84875d1 Compare February 16, 2025 13:23
@rintaro
Copy link
Member Author

rintaro commented Feb 16, 2025

@swift-ci Please smoke test

@rintaro
Copy link
Member Author

rintaro commented Feb 16, 2025

@swift-ci Please smoke test Linux

Comment on lines 235 to +236
let captures = node.items.lazy.map { node in
self.generate(closureCapture: node)
self.generate(closureCapture: node, capturedSelfDecl: &result.capturedSelfDecl)
Copy link
Contributor

@hamishknight hamishknight Feb 16, 2025

Choose a reason for hiding this comment

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

Using an inout argument in a lazy transform feels like it has the potential to be a footgun, though I guess it doesn't really matter in practice given we know bridgedArray immediately iterates in order

@rintaro rintaro merged commit 20a6f2c into swiftlang:main Feb 16, 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.

2 participants