Skip to content

[AST] Improve BinaryExpr #37501

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 1 commit into from
May 19, 2021
Merged

Conversation

hamishknight
Copy link
Contributor

Abstract away the TupleExpr gunk and expose getLHS and getRHS accessors. This is in preparation for completely expunging the use of TupleExpr as an argument list (#37435).

Abstract away the TupleExpr gunk and expose
`getLHS` and `getRHS` accessors. This is in
preparation for completely expunging the use
of TupleExpr as an argument list.
@hamishknight
Copy link
Contributor Author

@swift-ci please test

@hamishknight hamishknight requested a review from CodaFi May 19, 2021 13:50

return getTypeOfCompletionOperatorImpl(DC, &binaryExpr,
referencedDecl);
auto *binaryExpr = BinaryExpr::create(DC->getASTContext(), LHS, opExpr,
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh right, that place we make expression nodes on the stack.

Is there any worry about ASTContext heap growth here? My thought is no since this is, what, at most a handful of words per expr...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it's okay, I mean we already allocate an ASTNode for the TupleExpr here, and will allocate other nodes for the earlier call to resolveDeclRefExpr, not to mention all the nodes creating while parsing and type-checking. And even during cached code completion, we throw away the ASTContext after a fixed number of completions, so the growth should never be unbounded I believe.

@hamishknight hamishknight merged commit 283abc0 into swiftlang:main May 19, 2021
@hamishknight hamishknight deleted the twos-complement branch May 19, 2021 17:53
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