From 0a499aae46c12d4a61a62ee656072fc79802bee0 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Mon, 29 Jul 2024 17:05:10 -0700 Subject: [PATCH 1/4] Remove unused variable in ts transform --- src/compiler/transformers/ts.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/compiler/transformers/ts.ts b/src/compiler/transformers/ts.ts index 668da90d8e696..fa0456177acb9 100644 --- a/src/compiler/transformers/ts.ts +++ b/src/compiler/transformers/ts.ts @@ -266,7 +266,6 @@ export function transformTypeScript(context: TransformationContext) { let currentNamespaceContainerName: Identifier; let currentLexicalScope: SourceFile | Block | ModuleBlock | CaseBlock; let currentScopeFirstDeclarationsOfName: Map<__String, Node> | undefined; - let currentClassHasParameterProperties: boolean | undefined; /** * Keeps track of whether expression substitution has been enabled for specific edge cases. @@ -323,7 +322,6 @@ export function transformTypeScript(context: TransformationContext) { // Save state const savedCurrentScope = currentLexicalScope; const savedCurrentScopeFirstDeclarationsOfName = currentScopeFirstDeclarationsOfName; - const savedCurrentClassHasParameterProperties = currentClassHasParameterProperties; // Handle state changes before visiting a node. onBeforeVisitNode(node); @@ -336,7 +334,6 @@ export function transformTypeScript(context: TransformationContext) { } currentLexicalScope = savedCurrentScope; - currentClassHasParameterProperties = savedCurrentClassHasParameterProperties; return visited; } @@ -1242,7 +1239,7 @@ export function transformTypeScript(context: TransformationContext) { // The names are used more than once when: // - the property is non-static and its initializer is moved to the constructor (when there are parameter property assignments). // - the property has a decorator. - if (isComputedPropertyName(name) && ((!hasStaticModifier(member) && currentClassHasParameterProperties) || hasDecorators(member) && legacyDecorators)) { + if (isComputedPropertyName(name) && hasDecorators(member) && legacyDecorators) { const expression = visitNode(name.expression, visitor, isExpression); Debug.assert(expression); const innerExpression = skipPartiallyEmittedExpressions(expression); From 1b9d30886f268f354331eb0b9b68fe2e62b04094 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Mon, 29 Jul 2024 17:06:18 -0700 Subject: [PATCH 2/4] Modify comment --- src/compiler/transformers/ts.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/compiler/transformers/ts.ts b/src/compiler/transformers/ts.ts index fa0456177acb9..4cd6af8ac0a43 100644 --- a/src/compiler/transformers/ts.ts +++ b/src/compiler/transformers/ts.ts @@ -1236,9 +1236,7 @@ export function transformTypeScript(context: TransformationContext) { function visitPropertyNameOfClassElement(member: ClassElement): PropertyName { const name = member.name!; // Computed property names need to be transformed into a hoisted variable when they are used more than once. - // The names are used more than once when: - // - the property is non-static and its initializer is moved to the constructor (when there are parameter property assignments). - // - the property has a decorator. + // The names are used more than once when the property has a decorator. if (isComputedPropertyName(name) && hasDecorators(member) && legacyDecorators) { const expression = visitNode(name.expression, visitor, isExpression); Debug.assert(expression); From cfccaf52e48748b85fbce2a17b59cf2c2da2c306 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Mon, 29 Jul 2024 17:06:33 -0700 Subject: [PATCH 3/4] Now flip the condition --- src/compiler/transformers/ts.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/transformers/ts.ts b/src/compiler/transformers/ts.ts index 4cd6af8ac0a43..763eb3f7d0f94 100644 --- a/src/compiler/transformers/ts.ts +++ b/src/compiler/transformers/ts.ts @@ -1237,7 +1237,7 @@ export function transformTypeScript(context: TransformationContext) { const name = member.name!; // Computed property names need to be transformed into a hoisted variable when they are used more than once. // The names are used more than once when the property has a decorator. - if (isComputedPropertyName(name) && hasDecorators(member) && legacyDecorators) { + if (legacyDecorators && isComputedPropertyName(name) && hasDecorators(member)) { const expression = visitNode(name.expression, visitor, isExpression); Debug.assert(expression); const innerExpression = skipPartiallyEmittedExpressions(expression); From a4f9eef95a3627675f06718421ec9bb28eb29345 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Mon, 29 Jul 2024 18:43:45 -0700 Subject: [PATCH 4/4] Unused import --- src/compiler/transformers/ts.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/compiler/transformers/ts.ts b/src/compiler/transformers/ts.ts index 763eb3f7d0f94..f50d4415ad86b 100644 --- a/src/compiler/transformers/ts.ts +++ b/src/compiler/transformers/ts.ts @@ -60,7 +60,6 @@ import { getStrictOptionValue, getTextOfNode, hasDecorators, - hasStaticModifier, hasSyntacticModifier, HeritageClause, Identifier,