Skip to content
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

align ClassStaticBlockDeclaration with IIFE in CFA #44969

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

@Zzzen
Copy link
Contributor

@Zzzen Zzzen commented Jul 10, 2021

Fixes #44949

!hasSyntacticModifier(node, ModifierFlags.Async) &&
!(node as FunctionLikeDeclaration).asteriskToken &&
!!getImmediatelyInvokedFunctionExpression(node)) ||
node.kind === SyntaxKind.ClassStaticBlockDeclaration;
Copy link
Contributor Author

@Zzzen Zzzen Jul 10, 2021

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.

Copy link
Member

@sandersn sandersn Aug 2, 2021

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.

@sandersn sandersn added this to Not started in PR Backlog Jul 15, 2021
@sandersn sandersn requested review from sandersn and rbuckton Aug 2, 2021
PR Backlog automation moved this from Not started to Needs merge Aug 2, 2021
Copy link
Member

@sandersn sandersn left a comment

Looks good but one naming suggestion and it would be nice to have a second opinion on the semantics from @rbuckton

@@ -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 =
Copy link
Member

@sandersn sandersn Aug 2, 2021

Choose a reason for hiding this comment

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

Suggested change
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;
Copy link
Member

@sandersn sandersn Aug 2, 2021

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.

@fwienber
Copy link

@fwienber fwienber commented Sep 13, 2021

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
PR Backlog
  
Needs merge
Linked issues

Successfully merging this pull request may close these issues.

5 participants