Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions src/compiler/transformers/ts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ import {
getStrictOptionValue,
getTextOfNode,
hasDecorators,
hasStaticModifier,
hasSyntacticModifier,
HeritageClause,
Identifier,
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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);
Expand All @@ -336,7 +333,6 @@ export function transformTypeScript(context: TransformationContext) {
}

currentLexicalScope = savedCurrentScope;
currentClassHasParameterProperties = savedCurrentClassHasParameterProperties;
return visited;
}

Expand Down Expand Up @@ -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);
Expand Down