mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-15 11:35:42 -06:00
Fix name generation scoping (#58418)
This commit is contained in:
parent
e154d47851
commit
70d8ec2f26
@ -2125,13 +2125,9 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri
|
||||
}
|
||||
|
||||
function emitComputedPropertyName(node: ComputedPropertyName) {
|
||||
const savedPrivateNameTempFlags = privateNameTempFlags;
|
||||
const savedReservedMemberNames = reservedPrivateNames;
|
||||
popPrivateNameGenerationScope();
|
||||
writePunctuation("[");
|
||||
emitExpression(node.expression, parenthesizer.parenthesizeExpressionOfComputedPropertyName);
|
||||
writePunctuation("]");
|
||||
pushPrivateNameGenerationScope(savedPrivateNameTempFlags, savedReservedMemberNames);
|
||||
}
|
||||
|
||||
//
|
||||
@ -2198,15 +2194,10 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri
|
||||
}
|
||||
|
||||
function emitMethodSignature(node: MethodSignature) {
|
||||
pushNameGenerationScope(node);
|
||||
emitModifierList(node, node.modifiers);
|
||||
emit(node.name);
|
||||
emit(node.questionToken);
|
||||
emitTypeParameters(node, node.typeParameters);
|
||||
emitParameters(node, node.parameters);
|
||||
emitTypeAnnotation(node.type);
|
||||
writeTrailingSemicolon();
|
||||
popNameGenerationScope(node);
|
||||
emitSignatureAndBody(node, emitSignatureHead, emitEmptyFunctionBody);
|
||||
}
|
||||
|
||||
function emitMethodDeclaration(node: MethodDeclaration) {
|
||||
@ -2214,18 +2205,20 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri
|
||||
emit(node.asteriskToken);
|
||||
emit(node.name);
|
||||
emit(node.questionToken);
|
||||
emitSignatureAndBody(node, emitSignatureHead);
|
||||
emitSignatureAndBody(node, emitSignatureHead, emitFunctionBody);
|
||||
}
|
||||
|
||||
function emitClassStaticBlockDeclaration(node: ClassStaticBlockDeclaration) {
|
||||
writeKeyword("static");
|
||||
pushNameGenerationScope(node);
|
||||
emitBlockFunctionBody(node.body);
|
||||
popNameGenerationScope(node);
|
||||
}
|
||||
|
||||
function emitConstructor(node: ConstructorDeclaration) {
|
||||
emitDecoratorsAndModifiers(node, node.modifiers, /*allowDecorators*/ false);
|
||||
writeKeyword("constructor");
|
||||
emitSignatureAndBody(node, emitSignatureHead);
|
||||
emitSignatureAndBody(node, emitSignatureHead, emitFunctionBody);
|
||||
}
|
||||
|
||||
function emitAccessorDeclaration(node: AccessorDeclaration) {
|
||||
@ -2234,27 +2227,17 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri
|
||||
emitTokenWithComment(token, pos, writeKeyword, node);
|
||||
writeSpace();
|
||||
emit(node.name);
|
||||
emitSignatureAndBody(node, emitSignatureHead);
|
||||
emitSignatureAndBody(node, emitSignatureHead, emitFunctionBody);
|
||||
}
|
||||
|
||||
function emitCallSignature(node: CallSignatureDeclaration) {
|
||||
pushNameGenerationScope(node);
|
||||
emitTypeParameters(node, node.typeParameters);
|
||||
emitParameters(node, node.parameters);
|
||||
emitTypeAnnotation(node.type);
|
||||
writeTrailingSemicolon();
|
||||
popNameGenerationScope(node);
|
||||
emitSignatureAndBody(node, emitSignatureHead, emitEmptyFunctionBody);
|
||||
}
|
||||
|
||||
function emitConstructSignature(node: ConstructSignatureDeclaration) {
|
||||
pushNameGenerationScope(node);
|
||||
writeKeyword("new");
|
||||
writeSpace();
|
||||
emitTypeParameters(node, node.typeParameters);
|
||||
emitParameters(node, node.parameters);
|
||||
emitTypeAnnotation(node.type);
|
||||
writeTrailingSemicolon();
|
||||
popNameGenerationScope(node);
|
||||
emitSignatureAndBody(node, emitSignatureHead, emitEmptyFunctionBody);
|
||||
}
|
||||
|
||||
function emitIndexSignature(node: IndexSignatureDeclaration) {
|
||||
@ -2297,14 +2280,19 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri
|
||||
}
|
||||
|
||||
function emitFunctionType(node: FunctionTypeNode) {
|
||||
pushNameGenerationScope(node);
|
||||
emitSignatureAndBody(node, emitFunctionTypeHead, emitFunctionTypeBody);
|
||||
}
|
||||
|
||||
function emitFunctionTypeHead(node: FunctionTypeNode | ConstructorTypeNode) {
|
||||
emitTypeParameters(node, node.typeParameters);
|
||||
emitParametersForArrow(node, node.parameters);
|
||||
writeSpace();
|
||||
writePunctuation("=>");
|
||||
}
|
||||
|
||||
function emitFunctionTypeBody(node: FunctionTypeNode | ConstructorTypeNode) {
|
||||
writeSpace();
|
||||
emit(node.type);
|
||||
popNameGenerationScope(node);
|
||||
}
|
||||
|
||||
function emitJSDocFunctionType(node: JSDocFunctionType) {
|
||||
@ -2330,17 +2318,10 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri
|
||||
}
|
||||
|
||||
function emitConstructorType(node: ConstructorTypeNode) {
|
||||
pushNameGenerationScope(node);
|
||||
emitModifierList(node, node.modifiers);
|
||||
writeKeyword("new");
|
||||
writeSpace();
|
||||
emitTypeParameters(node, node.typeParameters);
|
||||
emitParameters(node, node.parameters);
|
||||
writeSpace();
|
||||
writePunctuation("=>");
|
||||
writeSpace();
|
||||
emit(node.type);
|
||||
popNameGenerationScope(node);
|
||||
emitSignatureAndBody(node, emitFunctionTypeHead, emitFunctionTypeBody);
|
||||
}
|
||||
|
||||
function emitTypeQuery(node: TypeQueryNode) {
|
||||
@ -2351,16 +2332,15 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri
|
||||
}
|
||||
|
||||
function emitTypeLiteral(node: TypeLiteralNode) {
|
||||
// Type literals don't have private names, but we need to push a new scope so that
|
||||
// we can step out of it when emitting a computed property.
|
||||
pushPrivateNameGenerationScope(TempFlags.Auto, /*newReservedMemberNames*/ undefined);
|
||||
pushNameGenerationScope(node);
|
||||
forEach(node.members, generateMemberNames);
|
||||
|
||||
writePunctuation("{");
|
||||
const flags = getEmitFlags(node) & EmitFlags.SingleLine ? ListFormat.SingleLineTypeLiteralMembers : ListFormat.MultiLineTypeLiteralMembers;
|
||||
emitList(node, node.members, flags | ListFormat.NoSpaceIfEmpty);
|
||||
writePunctuation("}");
|
||||
|
||||
popPrivateNameGenerationScope();
|
||||
popNameGenerationScope(node);
|
||||
}
|
||||
|
||||
function emitArrayType(node: ArrayTypeNode) {
|
||||
@ -2569,9 +2549,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri
|
||||
}
|
||||
|
||||
function emitObjectLiteralExpression(node: ObjectLiteralExpression) {
|
||||
// Object literals don't have private names, but we need to push a new scope so that
|
||||
// we can step out of it when emitting a computed property.
|
||||
pushPrivateNameGenerationScope(TempFlags.Auto, /*newReservedMemberNames*/ undefined);
|
||||
pushNameGenerationScope(node);
|
||||
forEach(node.properties, generateMemberNames);
|
||||
|
||||
const indentedFlag = getEmitFlags(node) & EmitFlags.Indented;
|
||||
@ -2587,7 +2565,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri
|
||||
decreaseIndent();
|
||||
}
|
||||
|
||||
popPrivateNameGenerationScope();
|
||||
popNameGenerationScope(node);
|
||||
}
|
||||
|
||||
function emitPropertyAccessExpression(node: PropertyAccessExpression) {
|
||||
@ -2714,7 +2692,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri
|
||||
|
||||
function emitArrowFunction(node: ArrowFunction) {
|
||||
emitModifierList(node, node.modifiers);
|
||||
emitSignatureAndBody(node, emitArrowFunctionHead);
|
||||
emitSignatureAndBody(node, emitArrowFunctionHead, emitArrowFunctionBody);
|
||||
}
|
||||
|
||||
function emitArrowFunctionHead(node: ArrowFunction) {
|
||||
@ -2725,6 +2703,16 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri
|
||||
emit(node.equalsGreaterThanToken);
|
||||
}
|
||||
|
||||
function emitArrowFunctionBody(node: ArrowFunction) {
|
||||
if (isBlock(node.body)) {
|
||||
emitBlockFunctionBody(node.body);
|
||||
}
|
||||
else {
|
||||
writeSpace();
|
||||
emitExpression(node.body, parenthesizer.parenthesizeConciseBodyOfArrowFunction);
|
||||
}
|
||||
}
|
||||
|
||||
function emitDeleteExpression(node: DeleteExpression) {
|
||||
emitTokenWithComment(SyntaxKind.DeleteKeyword, node.pos, writeKeyword, node);
|
||||
writeSpace();
|
||||
@ -3305,42 +3293,40 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri
|
||||
emit(node.asteriskToken);
|
||||
writeSpace();
|
||||
emitIdentifierName(node.name);
|
||||
emitSignatureAndBody(node, emitSignatureHead);
|
||||
emitSignatureAndBody(node, emitSignatureHead, emitFunctionBody);
|
||||
}
|
||||
|
||||
function emitSignatureAndBody<T extends FunctionLikeDeclaration>(node: T, emitSignatureHead: (node: T) => void) {
|
||||
function emitSignatureAndBody<T extends SignatureDeclaration>(node: T, emitSignatureHead: (node: T) => void, emitBody: (node: T) => void) {
|
||||
const indentedFlag = getEmitFlags(node) & EmitFlags.Indented;
|
||||
if (indentedFlag) {
|
||||
increaseIndent();
|
||||
}
|
||||
|
||||
pushNameGenerationScope(node);
|
||||
forEach(node.parameters, generateNames);
|
||||
emitSignatureHead(node);
|
||||
emitBody(node);
|
||||
popNameGenerationScope(node);
|
||||
|
||||
if (indentedFlag) {
|
||||
decreaseIndent();
|
||||
}
|
||||
}
|
||||
|
||||
function emitFunctionBody<T extends Exclude<FunctionLikeDeclaration, ArrowFunction>>(node: T) {
|
||||
const body = node.body;
|
||||
if (body) {
|
||||
if (isBlock(body)) {
|
||||
const indentedFlag = getEmitFlags(node) & EmitFlags.Indented;
|
||||
if (indentedFlag) {
|
||||
increaseIndent();
|
||||
}
|
||||
|
||||
pushNameGenerationScope(node);
|
||||
forEach(node.parameters, generateNames);
|
||||
generateNames(node.body);
|
||||
|
||||
emitSignatureHead(node);
|
||||
emitBlockFunctionBody(body);
|
||||
popNameGenerationScope(node);
|
||||
|
||||
if (indentedFlag) {
|
||||
decreaseIndent();
|
||||
}
|
||||
}
|
||||
else {
|
||||
emitSignatureHead(node);
|
||||
writeSpace();
|
||||
emitExpression(body, parenthesizer.parenthesizeConciseBodyOfArrowFunction);
|
||||
}
|
||||
emitBlockFunctionBody(body);
|
||||
}
|
||||
else {
|
||||
emitSignatureHead(node);
|
||||
writeTrailingSemicolon();
|
||||
}
|
||||
}
|
||||
|
||||
function emitEmptyFunctionBody(_node: SignatureDeclaration) {
|
||||
writeTrailingSemicolon();
|
||||
}
|
||||
|
||||
function emitSignatureHead(node: SignatureDeclaration) {
|
||||
emitTypeParameters(node, node.typeParameters);
|
||||
emitParameters(node, node.parameters);
|
||||
@ -3388,6 +3374,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri
|
||||
}
|
||||
|
||||
function emitBlockFunctionBody(body: Block) {
|
||||
generateNames(body);
|
||||
onBeforeEmitNode?.(body);
|
||||
writeSpace();
|
||||
writePunctuation("{");
|
||||
@ -3428,10 +3415,6 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri
|
||||
}
|
||||
|
||||
function emitClassDeclarationOrExpression(node: ClassDeclaration | ClassExpression) {
|
||||
pushPrivateNameGenerationScope(TempFlags.Auto, /*newReservedMemberNames*/ undefined);
|
||||
|
||||
forEach(node.members, generateMemberNames);
|
||||
|
||||
emitDecoratorsAndModifiers(node, node.modifiers, /*allowDecorators*/ true);
|
||||
emitTokenWithComment(SyntaxKind.ClassKeyword, moveRangePastModifiers(node).pos, writeKeyword, node);
|
||||
if (node.name) {
|
||||
@ -3446,24 +3429,22 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri
|
||||
|
||||
emitTypeParameters(node, node.typeParameters);
|
||||
emitList(node, node.heritageClauses, ListFormat.ClassHeritageClauses);
|
||||
|
||||
writeSpace();
|
||||
writePunctuation("{");
|
||||
|
||||
pushNameGenerationScope(node);
|
||||
forEach(node.members, generateMemberNames);
|
||||
emitList(node, node.members, ListFormat.ClassMembers);
|
||||
popNameGenerationScope(node);
|
||||
|
||||
writePunctuation("}");
|
||||
|
||||
if (indentedFlag) {
|
||||
decreaseIndent();
|
||||
}
|
||||
|
||||
popPrivateNameGenerationScope();
|
||||
}
|
||||
|
||||
function emitInterfaceDeclaration(node: InterfaceDeclaration) {
|
||||
// Interfaces don't have private names, but we need to push a new scope so that
|
||||
// we can step out of it when emitting a computed property.
|
||||
pushPrivateNameGenerationScope(TempFlags.Auto, /*newReservedMemberNames*/ undefined);
|
||||
|
||||
emitDecoratorsAndModifiers(node, node.modifiers, /*allowDecorators*/ false);
|
||||
writeKeyword("interface");
|
||||
writeSpace();
|
||||
@ -3472,10 +3453,13 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri
|
||||
emitList(node, node.heritageClauses, ListFormat.HeritageClauses);
|
||||
writeSpace();
|
||||
writePunctuation("{");
|
||||
emitList(node, node.members, ListFormat.InterfaceMembers);
|
||||
writePunctuation("}");
|
||||
|
||||
popPrivateNameGenerationScope();
|
||||
pushNameGenerationScope(node);
|
||||
forEach(node.members, generateMemberNames);
|
||||
emitList(node, node.members, ListFormat.InterfaceMembers);
|
||||
popNameGenerationScope(node);
|
||||
|
||||
writePunctuation("}");
|
||||
}
|
||||
|
||||
function emitTypeAliasDeclaration(node: TypeAliasDeclaration) {
|
||||
@ -4488,7 +4472,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri
|
||||
emitList(parentNode, parameters, ListFormat.Parameters);
|
||||
}
|
||||
|
||||
function canEmitSimpleArrowHead(parentNode: FunctionTypeNode | ArrowFunction, parameters: NodeArray<ParameterDeclaration>) {
|
||||
function canEmitSimpleArrowHead(parentNode: FunctionTypeNode | ConstructorTypeNode | ArrowFunction, parameters: NodeArray<ParameterDeclaration>) {
|
||||
const parameter = singleOrUndefined(parameters);
|
||||
return parameter
|
||||
&& parameter.pos === parentNode.pos // may not have parsed tokens between parent and parameter
|
||||
@ -4504,7 +4488,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri
|
||||
&& isIdentifier(parameter.name); // parameter name must be identifier
|
||||
}
|
||||
|
||||
function emitParametersForArrow(parentNode: FunctionTypeNode | ArrowFunction, parameters: NodeArray<ParameterDeclaration>) {
|
||||
function emitParametersForArrow(parentNode: FunctionTypeNode | ConstructorTypeNode | ArrowFunction, parameters: NodeArray<ParameterDeclaration>) {
|
||||
if (canEmitSimpleArrowHead(parentNode, parameters)) {
|
||||
emitList(parentNode, parameters, ListFormat.Parameters & ~ListFormat.Parenthesis);
|
||||
}
|
||||
@ -5172,9 +5156,14 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri
|
||||
* Push a new name generation scope.
|
||||
*/
|
||||
function pushNameGenerationScope(node: Node | undefined) {
|
||||
privateNameTempFlagsStack.push(privateNameTempFlags);
|
||||
privateNameTempFlags = TempFlags.Auto;
|
||||
reservedPrivateNamesStack.push(reservedPrivateNames);
|
||||
|
||||
if (node && getEmitFlags(node) & EmitFlags.ReuseTempVariableScope) {
|
||||
return;
|
||||
}
|
||||
|
||||
tempFlagsStack.push(tempFlags);
|
||||
tempFlags = TempFlags.Auto;
|
||||
formattedNameTempFlagsStack.push(formattedNameTempFlags);
|
||||
@ -5186,9 +5175,13 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri
|
||||
* Pop the current name generation scope.
|
||||
*/
|
||||
function popNameGenerationScope(node: Node | undefined) {
|
||||
privateNameTempFlags = privateNameTempFlagsStack.pop()!;
|
||||
reservedPrivateNames = reservedPrivateNamesStack.pop();
|
||||
|
||||
if (node && getEmitFlags(node) & EmitFlags.ReuseTempVariableScope) {
|
||||
return;
|
||||
}
|
||||
|
||||
tempFlags = tempFlagsStack.pop()!;
|
||||
formattedNameTempFlags = formattedNameTempFlagsStack.pop();
|
||||
reservedNames = reservedNamesStack.pop();
|
||||
@ -5201,24 +5194,6 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri
|
||||
reservedNames.add(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Push a new member name generation scope.
|
||||
*/
|
||||
function pushPrivateNameGenerationScope(newPrivateNameTempFlags: TempFlags, newReservedMemberNames: Set<string> | undefined) {
|
||||
privateNameTempFlagsStack.push(privateNameTempFlags);
|
||||
privateNameTempFlags = newPrivateNameTempFlags;
|
||||
reservedPrivateNamesStack.push(reservedNames);
|
||||
reservedPrivateNames = newReservedMemberNames;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pop the current member name generation scope.
|
||||
*/
|
||||
function popPrivateNameGenerationScope() {
|
||||
privateNameTempFlags = privateNameTempFlagsStack.pop()!;
|
||||
reservedPrivateNames = reservedPrivateNamesStack.pop();
|
||||
}
|
||||
|
||||
function reservePrivateNameInNestedScopes(name: string) {
|
||||
if (!reservedPrivateNames || reservedPrivateNames === lastOrUndefined(reservedPrivateNamesStack)) {
|
||||
reservedPrivateNames = new Set();
|
||||
@ -5318,7 +5293,9 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
case SyntaxKind.ShorthandPropertyAssignment:
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
generateNameIfNeeded((node as NamedDeclaration).name);
|
||||
@ -5372,7 +5349,30 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri
|
||||
}
|
||||
|
||||
function isReservedName(name: string, privateName: boolean): boolean {
|
||||
return privateName ? !!reservedPrivateNames?.has(name) : !!reservedNames?.has(name);
|
||||
let set: Set<string> | undefined;
|
||||
let stack: (Set<string> | undefined)[];
|
||||
if (privateName) {
|
||||
set = reservedPrivateNames;
|
||||
stack = reservedPrivateNamesStack;
|
||||
}
|
||||
else {
|
||||
set = reservedNames;
|
||||
stack = reservedNamesStack;
|
||||
}
|
||||
|
||||
if (set?.has(name)) {
|
||||
return true;
|
||||
}
|
||||
for (let i = stack.length - 1; i >= 0; i--) {
|
||||
if (set === stack[i]) {
|
||||
continue;
|
||||
}
|
||||
set = stack[i];
|
||||
if (set?.has(name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -17,4 +17,29 @@ describe("unittests:: evaluation:: asyncArrowEvaluation", () => {
|
||||
await result.main();
|
||||
assert.instanceOf(result.output[0].a(), result.A);
|
||||
});
|
||||
|
||||
// https://github.com/microsoft/TypeScript/issues/57897
|
||||
it("Class alias (es5)", async () => {
|
||||
const result = evaluator.evaluateTypeScript(`
|
||||
class X {
|
||||
public static a = async (someVar: boolean = true) => {
|
||||
return await X.b();
|
||||
};
|
||||
|
||||
public static b = async () => {
|
||||
return "GOOD";
|
||||
};
|
||||
}
|
||||
|
||||
export async function main() {
|
||||
try {
|
||||
return await X.a();
|
||||
}
|
||||
catch (e) {
|
||||
return "BAD";
|
||||
}
|
||||
}`);
|
||||
const output = await result.main();
|
||||
assert.equal(output, "GOOD");
|
||||
});
|
||||
});
|
||||
|
||||
@ -79,17 +79,17 @@ function f12() { return (...args_1) => {
|
||||
function f() {
|
||||
const a1 = (x_1, ...args_1) => __awaiter(this, [x_1, ...args_1], void 0, function* (x, y = z) { });
|
||||
const a2 = (_a) => __awaiter(this, [_a], void 0, function* ({ [z]: x }) { });
|
||||
const a3 = (...args_2) => {
|
||||
const a3 = (...args_1) => {
|
||||
var arguments_10 = arguments;
|
||||
return __awaiter(this, [...args_2], void 0, function* (x = z) { return () => __awaiter(this, void 0, void 0, function* () { return arguments_10; }); });
|
||||
return __awaiter(this, [...args_1], void 0, function* (x = z) { return () => __awaiter(this, void 0, void 0, function* () { return arguments_10; }); });
|
||||
};
|
||||
const a4 = (...args_2) => __awaiter(this, [...args_2], void 0, function* (x = z) { return () => __awaiter(this, void 0, void 0, function* () { return () => __awaiter(this, void 0, void 0, function* () { return arguments_10; }); }); });
|
||||
const a5 = (...args_3) => __awaiter(this, [...args_3], void 0, function* (x = z, ...args) { });
|
||||
const a6 = (...args_4) => __awaiter(this, [...args_4], void 0, function* (x = z, ...args) { return () => __awaiter(this, void 0, void 0, function* () { return arguments_10; }); });
|
||||
const a7 = (...args_5) => __awaiter(this, [...args_5], void 0, function* (x = z, ...args) { return () => __awaiter(this, void 0, void 0, function* () { return () => __awaiter(this, void 0, void 0, function* () { return arguments_10; }); }); });
|
||||
const a8 = () => __awaiter(this, void 0, void 0, function* () { return (...args_6) => __awaiter(this, [...args_6], void 0, function* (x = z) { return arguments_10; }); });
|
||||
const a9 = () => __awaiter(this, void 0, void 0, function* () { return (...args_7) => __awaiter(this, [...args_7], void 0, function* (x = z) { return () => __awaiter(this, void 0, void 0, function* () { return arguments_10; }); }); });
|
||||
const a10 = (...args_8) => __awaiter(this, [...args_8], void 0, function* (x = z) { return () => __awaiter(this, void 0, void 0, function* () { return function () {
|
||||
const a4 = (...args_1) => __awaiter(this, [...args_1], void 0, function* (x = z) { return () => __awaiter(this, void 0, void 0, function* () { return () => __awaiter(this, void 0, void 0, function* () { return arguments_10; }); }); });
|
||||
const a5 = (...args_1) => __awaiter(this, [...args_1], void 0, function* (x = z, ...args) { });
|
||||
const a6 = (...args_1) => __awaiter(this, [...args_1], void 0, function* (x = z, ...args) { return () => __awaiter(this, void 0, void 0, function* () { return arguments_10; }); });
|
||||
const a7 = (...args_1) => __awaiter(this, [...args_1], void 0, function* (x = z, ...args) { return () => __awaiter(this, void 0, void 0, function* () { return () => __awaiter(this, void 0, void 0, function* () { return arguments_10; }); }); });
|
||||
const a8 = () => __awaiter(this, void 0, void 0, function* () { return (...args_1) => __awaiter(this, [...args_1], void 0, function* (x = z) { return arguments_10; }); });
|
||||
const a9 = () => __awaiter(this, void 0, void 0, function* () { return (...args_1) => __awaiter(this, [...args_1], void 0, function* (x = z) { return () => __awaiter(this, void 0, void 0, function* () { return arguments_10; }); }); });
|
||||
const a10 = (...args_1) => __awaiter(this, [...args_1], void 0, function* (x = z) { return () => __awaiter(this, void 0, void 0, function* () { return function () {
|
||||
var arguments_11 = arguments;
|
||||
return __awaiter(this, void 0, void 0, function* () { return () => __awaiter(this, void 0, void 0, function* () { return arguments_11; }); });
|
||||
}; }); });
|
||||
|
||||
@ -30,7 +30,7 @@ class C1 {
|
||||
static set ["z"](value) { C1.#_d_accessor_storage = value; }
|
||||
}
|
||||
class C2 {
|
||||
#_e_accessor_storage = 1;
|
||||
get [_a = f()]() { return this.#_e_accessor_storage; }
|
||||
set [_a](value) { this.#_e_accessor_storage = value; }
|
||||
#_a_accessor_storage = 1;
|
||||
get [_a = f()]() { return this.#_a_accessor_storage; }
|
||||
set [_a](value) { this.#_a_accessor_storage = value; }
|
||||
}
|
||||
|
||||
@ -189,10 +189,10 @@ let C = (() => {
|
||||
set x(value) { }
|
||||
/*13*/
|
||||
y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, 1));
|
||||
#z_accessor_storage = (__runInitializers(this, _y_extraInitializers), __runInitializers(this, _z_initializers, 1));
|
||||
#z_1_accessor_storage = (__runInitializers(this, _y_extraInitializers), __runInitializers(this, _z_initializers, 1));
|
||||
/*16*/
|
||||
get z() { return this.#z_accessor_storage; }
|
||||
set z(value) { this.#z_accessor_storage = value; }
|
||||
get z() { return this.#z_1_accessor_storage; }
|
||||
set z(value) { this.#z_1_accessor_storage = value; }
|
||||
static {
|
||||
/*28*/
|
||||
_C_y = { value: (__runInitializers(_classThis, _staticExtraInitializers), __runInitializers(_classThis, _static_private_y_initializers, 1)) };
|
||||
|
||||
@ -189,10 +189,10 @@ let C = (() => {
|
||||
set x(value) { }
|
||||
/*13*/
|
||||
y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, 1));
|
||||
#z_accessor_storage = (__runInitializers(this, _y_extraInitializers), __runInitializers(this, _z_initializers, 1));
|
||||
#z_1_accessor_storage = (__runInitializers(this, _y_extraInitializers), __runInitializers(this, _z_initializers, 1));
|
||||
/*16*/
|
||||
get z() { return this.#z_accessor_storage; }
|
||||
set z(value) { this.#z_accessor_storage = value; }
|
||||
get z() { return this.#z_1_accessor_storage; }
|
||||
set z(value) { this.#z_1_accessor_storage = value; }
|
||||
static {
|
||||
/*28*/
|
||||
_C_y = { value: (__runInitializers(_classThis, _staticExtraInitializers), __runInitializers(_classThis, _static_private_y_initializers, 1)) };
|
||||
|
||||
@ -166,9 +166,9 @@ let C = (() => {
|
||||
get x() { return 1; }
|
||||
set x(value) { }
|
||||
y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, 1));
|
||||
#z_accessor_storage = (__runInitializers(this, _y_extraInitializers), __runInitializers(this, _z_initializers, 1));
|
||||
get z() { return this.#z_accessor_storage; }
|
||||
set z(value) { this.#z_accessor_storage = value; }
|
||||
#z_1_accessor_storage = (__runInitializers(this, _y_extraInitializers), __runInitializers(this, _z_initializers, 1));
|
||||
get z() { return this.#z_1_accessor_storage; }
|
||||
set z(value) { this.#z_1_accessor_storage = value; }
|
||||
static {
|
||||
_C_y = { value: (__runInitializers(_classThis, _staticExtraInitializers), __runInitializers(_classThis, _static_private_y_initializers, 1)) };
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -707,7 +707,7 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts
|
||||
5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
6 > ^
|
||||
7 > ^^^
|
||||
8 > ^^^^^^^^^^^^^->
|
||||
8 > ^^^^^^^^^^^^^^^->
|
||||
1->
|
||||
>
|
||||
> @dec
|
||||
@ -742,30 +742,30 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts
|
||||
6 >Emitted(117, 109) Source(20, 10) + SourceIndex(0)
|
||||
7 >Emitted(117, 112) Source(20, 11) + SourceIndex(0)
|
||||
---
|
||||
>>> #z_accessor_storage = (__runInitializers(this, _y_extraInitializers), __runInitializers(this, _z_initializers, 1));
|
||||
>>> #z_1_accessor_storage = (__runInitializers(this, _y_extraInitializers), __runInitializers(this, _z_initializers, 1));
|
||||
1->^^^^^^^^
|
||||
2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
3 > ^
|
||||
4 > ^^^
|
||||
2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
3 > ^
|
||||
4 > ^^^
|
||||
1->
|
||||
>
|
||||
> @dec
|
||||
> @dec
|
||||
>
|
||||
2 > accessor z =
|
||||
3 > 1
|
||||
4 > ;
|
||||
3 > 1
|
||||
4 > ;
|
||||
1->Emitted(118, 9) Source(24, 5) + SourceIndex(0)
|
||||
2 >Emitted(118, 120) Source(24, 18) + SourceIndex(0)
|
||||
3 >Emitted(118, 121) Source(24, 19) + SourceIndex(0)
|
||||
4 >Emitted(118, 124) Source(24, 20) + SourceIndex(0)
|
||||
2 >Emitted(118, 122) Source(24, 18) + SourceIndex(0)
|
||||
3 >Emitted(118, 123) Source(24, 19) + SourceIndex(0)
|
||||
4 >Emitted(118, 126) Source(24, 20) + SourceIndex(0)
|
||||
---
|
||||
>>> get z() { return this.#z_accessor_storage; }
|
||||
>>> get z() { return this.#z_1_accessor_storage; }
|
||||
1 >^^^^^^^^
|
||||
2 > ^^^^
|
||||
3 > ^
|
||||
4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
5 > ^^^^^^^->
|
||||
4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
5 > ^^^^^^^->
|
||||
1 >
|
||||
2 > accessor
|
||||
3 > z
|
||||
@ -773,13 +773,13 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts
|
||||
1 >Emitted(119, 9) Source(24, 5) + SourceIndex(0)
|
||||
2 >Emitted(119, 13) Source(24, 14) + SourceIndex(0)
|
||||
3 >Emitted(119, 14) Source(24, 15) + SourceIndex(0)
|
||||
4 >Emitted(119, 53) Source(24, 20) + SourceIndex(0)
|
||||
4 >Emitted(119, 55) Source(24, 20) + SourceIndex(0)
|
||||
---
|
||||
>>> set z(value) { this.#z_accessor_storage = value; }
|
||||
>>> set z(value) { this.#z_1_accessor_storage = value; }
|
||||
1->^^^^^^^^
|
||||
2 > ^^^^
|
||||
3 > ^
|
||||
4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
1->
|
||||
2 > accessor
|
||||
3 > z
|
||||
@ -787,7 +787,7 @@ sourceFile:esDecorators-classDeclaration-sourceMap.ts
|
||||
1->Emitted(120, 9) Source(24, 5) + SourceIndex(0)
|
||||
2 >Emitted(120, 13) Source(24, 14) + SourceIndex(0)
|
||||
3 >Emitted(120, 14) Source(24, 15) + SourceIndex(0)
|
||||
4 >Emitted(120, 59) Source(24, 20) + SourceIndex(0)
|
||||
4 >Emitted(120, 61) Source(24, 20) + SourceIndex(0)
|
||||
---
|
||||
>>> static {
|
||||
>>> _C_y = { value: (__runInitializers(_classThis, _staticExtraInitializers), __runInitializers(_classThis, _static_private_y_initializers, 1)) };
|
||||
|
||||
@ -154,10 +154,10 @@ class C {
|
||||
set x(value) { }
|
||||
/*14*/
|
||||
y = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _y_initializers, 1));
|
||||
#z_accessor_storage = (__runInitializers(this, _y_extraInitializers), __runInitializers(this, _z_initializers, 1));
|
||||
#z_1_accessor_storage = (__runInitializers(this, _y_extraInitializers), __runInitializers(this, _z_initializers, 1));
|
||||
/*17*/
|
||||
get z() { return this.#z_accessor_storage; }
|
||||
set z(value) { this.#z_accessor_storage = value; }
|
||||
get z() { return this.#z_1_accessor_storage; }
|
||||
set z(value) { this.#z_1_accessor_storage = value; }
|
||||
static {
|
||||
/*29*/
|
||||
_C_y = { value: (__runInitializers(_classThis, _staticExtraInitializers), __runInitializers(_classThis, _static_private_y_initializers, 1)) };
|
||||
|
||||
@ -45,13 +45,13 @@ class A {
|
||||
var _c;
|
||||
this.otherClass = _b;
|
||||
let y;
|
||||
({ x: ({ set value(_b) { __classPrivateFieldSet(_b, _b, _b, "f", _A_field); } }).value, y } = this.testObject());
|
||||
([({ set value(_b) { __classPrivateFieldSet(_b, _b, _b, "f", _A_field); } }).value, y] = this.testArray());
|
||||
({ a: ({ set value(_b) { __classPrivateFieldSet(_b, _b, _b, "f", _A_field); } }).value, b: [({ set value(_b) { __classPrivateFieldSet(_b, _b, _b, "f", _A_field); } }).value] } = { a: 1, b: [2] });
|
||||
[({ set value(_b) { __classPrivateFieldSet(_b, _b, _b, "f", _A_field); } }).value, [({ set value(_b) { __classPrivateFieldSet(_b, _b, _b, "f", _A_field); } }).value]] = [1, [2]];
|
||||
({ a: ({ set value(_b) { __classPrivateFieldSet(_b, _b, _b, "f", _A_field); } }).value = 1, b: [({ set value(_b) { __classPrivateFieldSet(_b, _b, _b, "f", _A_field); } }).value = 1] } = { b: [] });
|
||||
[({ set value(_b) { __classPrivateFieldSet(_b, _b, _b, "f", _A_field); } }).value = 2] = [];
|
||||
_c = this.otherClass, [({ set value(_b) { __classPrivateFieldSet(_c, _b, _b, "f", _A_field); } }).value = 2] = [];
|
||||
({ x: ({ set value(_d) { __classPrivateFieldSet(_b, _b, _d, "f", _A_field); } }).value, y } = this.testObject());
|
||||
([({ set value(_d) { __classPrivateFieldSet(_b, _b, _d, "f", _A_field); } }).value, y] = this.testArray());
|
||||
({ a: ({ set value(_d) { __classPrivateFieldSet(_b, _b, _d, "f", _A_field); } }).value, b: [({ set value(_d) { __classPrivateFieldSet(_b, _b, _d, "f", _A_field); } }).value] } = { a: 1, b: [2] });
|
||||
[({ set value(_d) { __classPrivateFieldSet(_b, _b, _d, "f", _A_field); } }).value, [({ set value(_d) { __classPrivateFieldSet(_b, _b, _d, "f", _A_field); } }).value]] = [1, [2]];
|
||||
({ a: ({ set value(_d) { __classPrivateFieldSet(_b, _b, _d, "f", _A_field); } }).value = 1, b: [({ set value(_d) { __classPrivateFieldSet(_b, _b, _d, "f", _A_field); } }).value = 1] } = { b: [] });
|
||||
[({ set value(_d) { __classPrivateFieldSet(_b, _b, _d, "f", _A_field); } }).value = 2] = [];
|
||||
_c = this.otherClass, [({ set value(_d) { __classPrivateFieldSet(_c, _b, _d, "f", _A_field); } }).value = 2] = [];
|
||||
}
|
||||
static test(_a) {
|
||||
[({ set value(_c) { __classPrivateFieldSet(_a, _b, _c, "f", _A_field); } }).value] = [2];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user