Skip to content

Commit aa8a2c0

Browse files
authored
Remove unused variable in ts transform (#59467)
1 parent 5e9e6ad commit aa8a2c0

File tree

1 file changed

+2
-8
lines changed
  • src/compiler/transformers

1 file changed

+2
-8
lines changed

src/compiler/transformers/ts.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ import {
6060
getStrictOptionValue,
6161
getTextOfNode,
6262
hasDecorators,
63-
hasStaticModifier,
6463
hasSyntacticModifier,
6564
HeritageClause,
6665
Identifier,
@@ -266,7 +265,6 @@ export function transformTypeScript(context: TransformationContext) {
266265
let currentNamespaceContainerName: Identifier;
267266
let currentLexicalScope: SourceFile | Block | ModuleBlock | CaseBlock;
268267
let currentScopeFirstDeclarationsOfName: Map<__String, Node> | undefined;
269-
let currentClassHasParameterProperties: boolean | undefined;
270268

271269
/**
272270
* Keeps track of whether expression substitution has been enabled for specific edge cases.
@@ -323,7 +321,6 @@ export function transformTypeScript(context: TransformationContext) {
323321
// Save state
324322
const savedCurrentScope = currentLexicalScope;
325323
const savedCurrentScopeFirstDeclarationsOfName = currentScopeFirstDeclarationsOfName;
326-
const savedCurrentClassHasParameterProperties = currentClassHasParameterProperties;
327324

328325
// Handle state changes before visiting a node.
329326
onBeforeVisitNode(node);
@@ -336,7 +333,6 @@ export function transformTypeScript(context: TransformationContext) {
336333
}
337334

338335
currentLexicalScope = savedCurrentScope;
339-
currentClassHasParameterProperties = savedCurrentClassHasParameterProperties;
340336
return visited;
341337
}
342338

@@ -1239,10 +1235,8 @@ export function transformTypeScript(context: TransformationContext) {
12391235
function visitPropertyNameOfClassElement(member: ClassElement): PropertyName {
12401236
const name = member.name!;
12411237
// Computed property names need to be transformed into a hoisted variable when they are used more than once.
1242-
// The names are used more than once when:
1243-
// - the property is non-static and its initializer is moved to the constructor (when there are parameter property assignments).
1244-
// - the property has a decorator.
1245-
if (isComputedPropertyName(name) && ((!hasStaticModifier(member) && currentClassHasParameterProperties) || hasDecorators(member) && legacyDecorators)) {
1238+
// The names are used more than once when the property has a decorator.
1239+
if (legacyDecorators && isComputedPropertyName(name) && hasDecorators(member)) {
12461240
const expression = visitNode(name.expression, visitor, isExpression);
12471241
Debug.assert(expression);
12481242
const innerExpression = skipPartiallyEmittedExpressions(expression);

0 commit comments

Comments
 (0)