Skip to content

A couple of ReturnStmt tweaks #71094

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
merged 4 commits into from
Jan 24, 2024
Merged

Conversation

hamishknight
Copy link
Contributor

Introduce ReturnStmt::createParsed and ReturnStmt::createImplicit, and tweak a couple of other things.

These are both synthesized returns, so they ought
to be marked implicit.
Add `ReturnStmt::createParsed` and `createImplict`.
Avoid forming invalid source ranges when
`ReturnLoc` is invalid. Also introduce a utility
to make this kind of range computation easier,
and use it in a couple of other cases.
The `return` keyword here doesn't have a source
location, so unset it. This matches the other
implicit single expression returns.
Copy link
Contributor

@bnbarham bnbarham left a comment

Choose a reason for hiding this comment

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

Thanks for the cleanup 🙇. Going to do BraceStmt too 😆?

@hamishknight
Copy link
Contributor Author

swiftlang/llvm-project#8027

@swift-ci please test

@hamishknight
Copy link
Contributor Author

hamishknight commented Jan 23, 2024

Going to do BraceStmt too 😆?

Heh, we actually have BraceStmt::createImplicit already, just need to go through and migrate everything passing /*implicit*/ true to BraceStmt::create 😅

@hamishknight hamishknight merged commit 3a8e31d into swiftlang:main Jan 24, 2024
@hamishknight hamishknight deleted the return-tweaks branch January 24, 2024 10:07
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