Remove unused variable in ts transform (#59467)
This commit is contained in:
Родитель
5e9e6ad295
Коммит
aa8a2c0bb4
|
@ -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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче