-
Notifications
You must be signed in to change notification settings - Fork 12.8k
align ClassStaticBlockDeclaration with IIFE in CFA #44969
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
!hasSyntacticModifier(node, ModifierFlags.Async) && | ||
!(node as FunctionLikeDeclaration).asteriskToken && | ||
!!getImmediatelyInvokedFunctionExpression(node)) || | ||
node.kind === SyntaxKind.ClassStaticBlockDeclaration; |
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 am not sure how to format these lines, so here is how prettier handles it.
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 would have done it slightly differently, but prettier's format is fine.
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.
Looks good but one naming suggestion and it would be nice to have a second opinion on the semantics from @rbuckton
src/compiler/binder.ts
Outdated
@@ -657,19 +657,23 @@ namespace ts { | |||
const saveExceptionTarget = currentExceptionTarget; | |||
const saveActiveLabelList = activeLabelList; | |||
const saveHasExplicitReturn = hasExplicitReturn; | |||
const isIIFE = containerFlags & ContainerFlags.IsFunctionExpression && !hasSyntacticModifier(node, ModifierFlags.Async) && | |||
!(node as FunctionLikeDeclaration).asteriskToken && !!getImmediatelyInvokedFunctionExpression(node); | |||
const isIIFELike = |
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.
const isIIFELike = | |
const isImmediatelyInvoked = |
(or isImmediate
for even more old-school flavor)
!hasSyntacticModifier(node, ModifierFlags.Async) && | ||
!(node as FunctionLikeDeclaration).asteriskToken && | ||
!!getImmediatelyInvokedFunctionExpression(node)) || | ||
node.kind === SyntaxKind.ClassStaticBlockDeclaration; |
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 would have done it slightly differently, but prettier's format is fine.
Hi! I just left a new test case at the issue which you might want to check! Would be awesome if that case was covered by your fix, too! |
Anything missing here but the last review? I'd love to retest this in the nightly build as soon as it is merged! |
@rbuckton please take a look. |
I'll have the bot run some extensive tests to make sure there's no other side effects from this change. |
@typescript-bot run dt |
The user suite test run you requested has finished and failed. I've opened a PR with the baseline diff from master. |
None of the reported test failures look to be related to this change. I think this is good to merge. |
Sorry to be unfamiliar with your process, but could you tell me how I can see which milestone / release this fix will be in? |
And also not part of the latest nightly build (if I didn't do something wrong when trying to test with the nightly)... |
Did you try 4.7.0-dev.20220329? |
Oh, my fault. Has arrived in nightly and works perfectly! |
My reproducer is now also fixed in TypeScript playground when choosing "nightly" ☺ |
Fixes #44949
Fixes #45932