-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Bind RHS of comma expressions too #47049
Conversation
@typescript-bot perf test this |
Heya @jakebailey, I've started to run the parallelized community code test suite on this PR at 5be2594. You can monitor the build here. |
Heya @jakebailey, I've started to run the perf test suite on this PR at 5be2594. You can monitor the build here. Update: The results are in! |
The user suite test run you requested has finished and failed. I've opened a PR with the baseline diff from master. |
@jakebailey Here they are:Comparison Report - main..47049
System
Hosts
Scenarios
Developer Information: |
src/compiler/binder.ts
Outdated
@@ -1574,6 +1574,11 @@ namespace ts { | |||
function onExit(node: BinaryExpression, state: WorkArea) { | |||
if (!state.skip) { | |||
const operator = node.operatorToken.kind; | |||
|
|||
if (operator === SyntaxKind.CommaToken) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would this be in onExit
and not onRight
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you look up a bit, the node.left
is processed in onOperator
, presumably because there's some work that is completed after onLeft
is completed. That's how it was added in #44487.
I tried putting it into onRight
first and hit infinite recursion, then realized that the other call wasn't in onLeft
and moved it down.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps I can get away with moving these around, though, and try running them after maybeBind
in onLeft
and onRight
instead. I'll try it. It'd sure look less weird.
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've moved things around to be a little less surprising.
Fixes #44487
This is an extension of #41312, applying
maybeBindExpressionFlowIfCall
the RHS too. The argument there was:I'd argue that this means that the entire chain of items in a comma expression (of any size) should have this applied, since they are being thought of here as a list of statements with potential side effects, and not just the leftmost expression.