-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Move emit helper flags to binder. #6495
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
Conversation
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.
Instead of this, what if you just looked for await expressions? Technically you don't need an await helper unless you use await right?
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 need the helper for any async function, even if it does not have an await.
|
@DanielRosenwasser any further comments? @mhegazy, @RyanCavanaugh any comments? |
src/compiler/binder.ts
Outdated
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.
Consider writing a nodeIsDecoratedCorrectly
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.
While I'm not keen on the proposed name, I think I will clean up the nodeIsDecorated function, as it can rely on nodeCanBeDecorated.
|
👍 |
Move emit helper flags to binder.
When investigating #6113 I found the issue also is also reproducible for
__extendsand other emit helpers.Previously, when we check a source file we use scoped variables (
emitExtends,emitAwaiter, etc.) in the checker that we reset before checking each source file. However, during the widening of object literals we check the object literal expression, which can then in turn check function expression bodies or object literal method bodies. When the function or method body contains a reference to a method defined in a different file, it both triggers the same checks as above, but for the wrong source file. By the time the checker gets to the source file, the expression's type has been cached. As a result, the expression is not rechecked and the triggers to set the scoped variables are never fired for the file.Since we are guaranteed to do a full walk of one file at a time in the binder, I've moved these checks for our various emit helpers there.