Remove unused variable in ts transform (#59467)

This commit is contained in:
Jake Bailey 2024-08-08 10:04:34 -07:00 коммит произвёл GitHub
Родитель 5e9e6ad295
Коммит aa8a2c0bb4
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
1 изменённых файлов: 2 добавлений и 8 удалений

Просмотреть файл

@ -60,7 +60,6 @@ import {
getStrictOptionValue,
getTextOfNode,
hasDecorators,
hasStaticModifier,
hasSyntacticModifier,
HeritageClause,
Identifier,
@ -266,7 +265,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 +321,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 +333,6 @@ export function transformTypeScript(context: TransformationContext) {
}
currentLexicalScope = savedCurrentScope;
currentClassHasParameterProperties = savedCurrentClassHasParameterProperties;
return visited;
}
@ -1239,10 +1235,8 @@ 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.
if (isComputedPropertyName(name) && ((!hasStaticModifier(member) && currentClassHasParameterProperties) || hasDecorators(member) && legacyDecorators)) {
// The names are used more than once when the property has a decorator.
if (legacyDecorators && isComputedPropertyName(name) && hasDecorators(member)) {
const expression = visitNode(name.expression, visitor, isExpression);
Debug.assert(expression);
const innerExpression = skipPartiallyEmittedExpressions(expression);