mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-16 07:13:43 -05:00
Component commits:
acdaf368c6 Move class name capture for private state until after declaration evaluates
Co-authored-by: Ron Buckton <rbuckton@microsoft.com>
This commit is contained in:
@@ -658,13 +658,14 @@ namespace ts {
|
||||
}
|
||||
|
||||
const staticProperties = getProperties(node, /*requireInitializer*/ false, /*isStatic*/ true);
|
||||
let pendingPrivateStateAssignment: BinaryExpression | undefined;
|
||||
if (shouldTransformPrivateElements && some(node.members, m => hasStaticModifier(m) && !!m.name && isPrivateIdentifier(m.name))) {
|
||||
const temp = factory.createTempVariable(hoistVariableDeclaration, /* reservedInNestedScopes */ true);
|
||||
getPrivateIdentifierEnvironment().classConstructor = factory.cloneNode(temp);
|
||||
getPendingExpressions().push(factory.createAssignment(
|
||||
pendingPrivateStateAssignment = factory.createAssignment(
|
||||
temp,
|
||||
factory.getInternalName(node)
|
||||
));
|
||||
);
|
||||
}
|
||||
|
||||
const extendsClauseElement = getEffectiveBaseTypeNode(node);
|
||||
@@ -682,6 +683,10 @@ namespace ts {
|
||||
)
|
||||
];
|
||||
|
||||
if (pendingPrivateStateAssignment) {
|
||||
getPendingExpressions().unshift(pendingPrivateStateAssignment);
|
||||
}
|
||||
|
||||
// Write any pending expressions from elided or moved computed property names
|
||||
if (some(pendingExpressions)) {
|
||||
statements.push(factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions)));
|
||||
|
||||
Reference in New Issue
Block a user