Skip to content

Commit 1cf55ef

Browse files
committed
Drop RESERVED argument in favor of removing parameter
1 parent 4a4b5d9 commit 1cf55ef

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1734
-937
lines changed

Diff for: src/compiler/checker.ts

+14-59
Large diffs are not rendered by default.

Diff for: src/compiler/debug.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ namespace ts {
1919
warnAfter?: Version | string;
2020
errorAfter?: Version | string;
2121
typeScriptVersion?: Version | string;
22+
name?: string;
2223
}
2324

2425
export namespace Debug {
@@ -732,7 +733,7 @@ namespace ts {
732733
}
733734

734735
export function deprecate<F extends (...args: any[]) => any>(func: F, options?: DeprecationOptions): F {
735-
const deprecation = createDeprecation(getFunctionName(func), options);
736+
const deprecation = createDeprecation(options?.name ?? getFunctionName(func), options);
736737
return wrapFunction(deprecation, func);
737738
}
738739
}

Diff for: src/compiler/factory/nodeFactory.ts

+37-150
Large diffs are not rendered by default.

Diff for: src/compiler/factory/utilities.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ namespace ts {
44
// Compound nodes
55

66
export function createEmptyExports(factory: NodeFactory) {
7-
return factory.createExportDeclaration(/*decorators*/ RESERVED, /*modifiers*/ undefined, /*isTypeOnly*/ false, factory.createNamedExports([]), /*moduleSpecifier*/ undefined);
7+
return factory.createExportDeclaration(/*modifiers*/ undefined, /*isTypeOnly*/ false, factory.createNamedExports([]), /*moduleSpecifier*/ undefined);
88
}
99

1010
export function createMemberAccessForPropertyName(factory: NodeFactory, target: Expression, memberName: PropertyName, location?: TextRange): MemberExpression {
@@ -519,7 +519,6 @@ namespace ts {
519519
}
520520
if (namedBindings) {
521521
const externalHelpersImportDeclaration = nodeFactory.createImportDeclaration(
522-
/*decorators*/ RESERVED,
523522
/*modifiers*/ undefined,
524523
nodeFactory.createImportClause(/*isTypeOnly*/ false, /*name*/ undefined, namedBindings),
525524
nodeFactory.createStringLiteral(externalHelpersModuleNameText),

Diff for: src/compiler/parser.ts

+17-24
Original file line numberDiff line numberDiff line change
@@ -3192,7 +3192,6 @@ namespace ts {
31923192
}
31933193
return finishNode(
31943194
factory.createParameterDeclaration(
3195-
/*decorators*/ RESERVED,
31963195
/*modifiers*/ undefined,
31973196
/*dotDotDotToken*/ undefined,
31983197
// TODO(rbuckton): JSDoc parameters don't have names (except `this`/`new`), should we manufacture an empty identifier?
@@ -3342,7 +3341,6 @@ namespace ts {
33423341

33433342
if (token() === SyntaxKind.ThisKeyword) {
33443343
const node = factory.createParameterDeclaration(
3345-
/*decorators*/ RESERVED,
33463344
decorators,
33473345
/*dotDotDotToken*/ undefined,
33483346
createIdentifier(/*isIdentifier*/ true),
@@ -3371,7 +3369,6 @@ namespace ts {
33713369
const node = withJSDoc(
33723370
finishNode(
33733371
factory.createParameterDeclaration(
3374-
/*decorators*/ RESERVED,
33753372
modifiers,
33763373
dotDotDotToken,
33773374
parseNameOfParameter(modifiers),
@@ -3558,7 +3555,7 @@ namespace ts {
35583555
const parameters = parseBracketedList<ParameterDeclaration>(ParsingContext.Parameters, () => parseParameter(/*inOuterAwaitContext*/ false), SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken);
35593556
const type = parseTypeAnnotation();
35603557
parseTypeMemberSemicolon();
3561-
const node = factory.createIndexSignature(/*decorators*/ RESERVED, modifiers, parameters, type);
3558+
const node = factory.createIndexSignature(modifiers, parameters, type);
35623559
node.illegalDecorators = decorators;
35633560
return withJSDoc(finishNode(node, pos), hasJSDoc);
35643561
}
@@ -4490,7 +4487,6 @@ namespace ts {
44904487
function parseSimpleArrowFunctionExpression(pos: number, identifier: Identifier, asyncModifier?: NodeArray<Modifier> | undefined): ArrowFunction {
44914488
Debug.assert(token() === SyntaxKind.EqualsGreaterThanToken, "parseSimpleArrowFunctionExpression should only have been called if we had a =>");
44924489
const parameter = factory.createParameterDeclaration(
4493-
/*decorators*/ RESERVED,
44944490
/*modifiers*/ undefined,
44954491
/*dotDotDotToken*/ undefined,
44964492
identifier,
@@ -6830,7 +6826,7 @@ namespace ts {
68306826
const type = parseReturnType(SyntaxKind.ColonToken, /*isType*/ false);
68316827
const body = parseFunctionBlockOrSemicolon(isGenerator | isAsync, Diagnostics.or_expected);
68326828
setAwaitContext(savedAwaitContext);
6833-
const node = factory.createFunctionDeclaration(/*decorators*/ RESERVED, modifiers, asteriskToken, name, typeParameters, parameters, type, body);
6829+
const node = factory.createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, body);
68346830
node.illegalDecorators = decorators;
68356831
return withJSDoc(finishNode(node, pos), hasJSDoc);
68366832
}
@@ -6854,7 +6850,7 @@ namespace ts {
68546850
const parameters = parseParameters(SignatureFlags.None);
68556851
const type = parseReturnType(SyntaxKind.ColonToken, /*isType*/ false);
68566852
const body = parseFunctionBlockOrSemicolon(SignatureFlags.None, Diagnostics.or_expected);
6857-
const node = factory.createConstructorDeclaration(/*decorators*/ RESERVED, modifiers, parameters, body);
6853+
const node = factory.createConstructorDeclaration(modifiers, parameters, body);
68586854

68596855
// Attach invalid nodes if they exist so that we can report them in the grammar checker.
68606856
node.illegalDecorators = decorators;
@@ -6883,7 +6879,6 @@ namespace ts {
68836879
const type = parseReturnType(SyntaxKind.ColonToken, /*isType*/ false);
68846880
const body = parseFunctionBlockOrSemicolon(isGenerator | isAsync, diagnosticMessage);
68856881
const node = factory.createMethodDeclaration(
6886-
/*decorators*/ RESERVED,
68876882
combineDecoratorsAndModifiers(decorators, modifiers),
68886883
asteriskToken,
68896884
name,
@@ -6912,7 +6907,6 @@ namespace ts {
69126907
const initializer = doOutsideOfContext(NodeFlags.YieldContext | NodeFlags.AwaitContext | NodeFlags.DisallowInContext, parseInitializer);
69136908
parseSemicolonAfterPropertyName(name, type, initializer);
69146909
const node = factory.createPropertyDeclaration(
6915-
/*decorators*/ RESERVED,
69166910
combineDecoratorsAndModifiers(decorators, modifiers),
69176911
name,
69186912
questionToken || exclamationToken,
@@ -6945,8 +6939,8 @@ namespace ts {
69456939
const type = parseReturnType(SyntaxKind.ColonToken, /*isType*/ false);
69466940
const body = parseFunctionBlockOrSemicolon(SignatureFlags.None);
69476941
const node = kind === SyntaxKind.GetAccessor
6948-
? factory.createGetAccessorDeclaration(/*decorators*/ RESERVED, combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, type, body)
6949-
: factory.createSetAccessorDeclaration(/*decorators*/ RESERVED, combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, body);
6942+
? factory.createGetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, type, body)
6943+
: factory.createSetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, body);
69506944
// Keep track of `typeParameters` (for both) and `type` (for setters) if they were parsed those indicate grammar errors
69516945
node.illegalTypeParameters = typeParameters;
69526946
if (isSetAccessorDeclaration(node)) node.illegalType = type;
@@ -7025,7 +7019,7 @@ namespace ts {
70257019
function parseClassStaticBlockDeclaration(pos: number, hasJSDoc: boolean, decorators: NodeArray<Decorator> | undefined, modifiers: ModifiersArray | undefined): ClassStaticBlockDeclaration {
70267020
parseExpectedToken(SyntaxKind.StaticKeyword);
70277021
const body = parseClassStaticBlockBody();
7028-
const node = withJSDoc(finishNode(factory.createClassStaticBlockDeclaration(/*decorators*/ RESERVED, RESERVED, body), pos), hasJSDoc);
7022+
const node = withJSDoc(finishNode(factory.createClassStaticBlockDeclaration(body), pos), hasJSDoc);
70297023
node.illegalDecorators = decorators;
70307024
node.illegalModifiers = modifiers;
70317025
return node;
@@ -7231,8 +7225,8 @@ namespace ts {
72317225
}
72327226
setAwaitContext(savedAwaitContext);
72337227
const node = kind === SyntaxKind.ClassDeclaration
7234-
? factory.createClassDeclaration(/*decorators*/ RESERVED, combineDecoratorsAndModifiers(decorators, modifiers), name, typeParameters, heritageClauses, members)
7235-
: factory.createClassExpression(/*decorators*/ RESERVED, combineDecoratorsAndModifiers(decorators, modifiers), name, typeParameters, heritageClauses, members);
7228+
? factory.createClassDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, typeParameters, heritageClauses, members)
7229+
: factory.createClassExpression(combineDecoratorsAndModifiers(decorators, modifiers), name, typeParameters, heritageClauses, members);
72367230
return withJSDoc(finishNode(node, pos), hasJSDoc);
72377231
}
72387232

@@ -7300,7 +7294,7 @@ namespace ts {
73007294
const typeParameters = parseTypeParameters();
73017295
const heritageClauses = parseHeritageClauses();
73027296
const members = parseObjectTypeMembers();
7303-
const node = factory.createInterfaceDeclaration(/*decorators*/ RESERVED, modifiers, name, typeParameters, heritageClauses, members);
7297+
const node = factory.createInterfaceDeclaration(modifiers, name, typeParameters, heritageClauses, members);
73047298
node.illegalDecorators = decorators;
73057299
return withJSDoc(finishNode(node, pos), hasJSDoc);
73067300
}
@@ -7312,7 +7306,7 @@ namespace ts {
73127306
parseExpected(SyntaxKind.EqualsToken);
73137307
const type = token() === SyntaxKind.IntrinsicKeyword && tryParse(parseKeywordAndNoDot) || parseType();
73147308
parseSemicolon();
7315-
const node = factory.createTypeAliasDeclaration(/*decorators*/ RESERVED, modifiers, name, typeParameters, type);
7309+
const node = factory.createTypeAliasDeclaration(modifiers, name, typeParameters, type);
73167310
node.illegalDecorators = decorators;
73177311
return withJSDoc(finishNode(node, pos), hasJSDoc);
73187312
}
@@ -7340,7 +7334,7 @@ namespace ts {
73407334
else {
73417335
members = createMissingList<EnumMember>();
73427336
}
7343-
const node = factory.createEnumDeclaration(/*decorators*/ RESERVED, modifiers, name, members);
7337+
const node = factory.createEnumDeclaration(modifiers, name, members);
73447338
node.illegalDecorators = decorators;
73457339
return withJSDoc(finishNode(node, pos), hasJSDoc);
73467340
}
@@ -7366,7 +7360,7 @@ namespace ts {
73667360
const body = parseOptional(SyntaxKind.DotToken)
73677361
? parseModuleOrNamespaceDeclaration(getNodePos(), /*hasJSDoc*/ false, /*decorators*/ undefined, /*modifiers*/ undefined, NodeFlags.NestedNamespace | namespaceFlag) as NamespaceDeclaration
73687362
: parseModuleBlock();
7369-
const node = factory.createModuleDeclaration(/*decorators*/ RESERVED, modifiers, name, body, flags);
7363+
const node = factory.createModuleDeclaration(modifiers, name, body, flags);
73707364
node.illegalDecorators = decorators;
73717365
return withJSDoc(finishNode(node, pos), hasJSDoc);
73727366
}
@@ -7390,7 +7384,7 @@ namespace ts {
73907384
else {
73917385
parseSemicolon();
73927386
}
7393-
const node = factory.createModuleDeclaration(/*decorators*/ RESERVED, modifiers, name, body, flags);
7387+
const node = factory.createModuleDeclaration(modifiers, name, body, flags);
73947388
node.illegalDecorators = decorators;
73957389
return withJSDoc(finishNode(node, pos), hasJSDoc);
73967390
}
@@ -7485,7 +7479,7 @@ namespace ts {
74857479
}
74867480

74877481
parseSemicolon();
7488-
const node = factory.createImportDeclaration(/*decorators*/ RESERVED, modifiers, importClause, moduleSpecifier, assertClause);
7482+
const node = factory.createImportDeclaration(modifiers, importClause, moduleSpecifier, assertClause);
74897483
node.illegalDecorators = decorators;
74907484
return withJSDoc(finishNode(node, pos), hasJSDoc);
74917485
}
@@ -7538,7 +7532,7 @@ namespace ts {
75387532
parseExpected(SyntaxKind.EqualsToken);
75397533
const moduleReference = parseModuleReference();
75407534
parseSemicolon();
7541-
const node = factory.createImportEqualsDeclaration(/*decorators*/ RESERVED, modifiers, isTypeOnly, identifier, moduleReference);
7535+
const node = factory.createImportEqualsDeclaration(modifiers, isTypeOnly, identifier, moduleReference);
75427536
node.illegalDecorators = decorators;
75437537
const finished = withJSDoc(finishNode(node, pos), hasJSDoc);
75447538
return finished;
@@ -7747,7 +7741,7 @@ namespace ts {
77477741
}
77487742
parseSemicolon();
77497743
setAwaitContext(savedAwaitContext);
7750-
const node = factory.createExportDeclaration(/*decorators*/ RESERVED, modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause);
7744+
const node = factory.createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause);
77517745
node.illegalDecorators = decorators;
77527746
return withJSDoc(finishNode(node, pos), hasJSDoc);
77537747
}
@@ -7765,7 +7759,7 @@ namespace ts {
77657759
const expression = parseAssignmentExpressionOrHigher();
77667760
parseSemicolon();
77677761
setAwaitContext(savedAwaitContext);
7768-
const node = factory.createExportAssignment(/*decorators*/ RESERVED, modifiers, isExportEquals, expression);
7762+
const node = factory.createExportAssignment(modifiers, isExportEquals, expression);
77697763
node.illegalDecorators = decorators;
77707764
return withJSDoc(finishNode(node, pos), hasJSDoc);
77717765
}
@@ -8616,7 +8610,6 @@ namespace ts {
86168610
if (parseOptional(SyntaxKind.DotToken)) {
86178611
const body = parseJSDocTypeNameWithNamespace(/*nested*/ true);
86188612
const jsDocNamespaceNode = factory.createModuleDeclaration(
8619-
/*decorators*/ RESERVED,
86208613
/*modifiers*/ undefined,
86218614
typeNameOrNamespaceName,
86228615
body,

Diff for: src/compiler/program.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2555,7 +2555,7 @@ namespace ts {
25552555

25562556
function createSyntheticImport(text: string, file: SourceFile) {
25572557
const externalHelpersModuleReference = factory.createStringLiteral(text);
2558-
const importDecl = factory.createImportDeclaration(/*decorators*/ RESERVED, /*modifiers*/ undefined, /*importClause*/ undefined, externalHelpersModuleReference, /*assertClause*/ undefined);
2558+
const importDecl = factory.createImportDeclaration(/*modifiers*/ undefined, /*importClause*/ undefined, externalHelpersModuleReference, /*assertClause*/ undefined);
25592559
addEmitFlags(importDecl, EmitFlags.NeverApplyImportHelper);
25602560
setParent(externalHelpersModuleReference, importDecl);
25612561
setParent(importDecl, file);

Diff for: src/compiler/transformers/classFields.ts

-8
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,6 @@ namespace ts {
433433
// Initializer is elided as the field is initialized in transformConstructor.
434434
return factory.updatePropertyDeclaration(
435435
node,
436-
/*decorators*/ RESERVED,
437436
visitNodes(node.modifiers, visitor, isModifierLike),
438437
node.name,
439438
/*questionOrExclamationToken*/ undefined,
@@ -461,8 +460,6 @@ namespace ts {
461460
const initializerStatement = transformPropertyOrClassStaticBlock(node, factory.createThis());
462461
if (initializerStatement) {
463462
const staticBlock = factory.createClassStaticBlockDeclaration(
464-
/*decorators*/ RESERVED,
465-
/*modifiers*/ RESERVED,
466463
factory.createBlock([initializerStatement])
467464
);
468465

@@ -1051,7 +1048,6 @@ namespace ts {
10511048
const statements: Statement[] = [
10521049
factory.updateClassDeclaration(
10531050
node,
1054-
/*decorators*/ RESERVED,
10551051
node.modifiers,
10561052
node.name,
10571053
/*typeParameters*/ undefined,
@@ -1123,7 +1119,6 @@ namespace ts {
11231119

11241120
const classExpression = factory.updateClassExpression(
11251121
node,
1126-
/*decorators*/ RESERVED,
11271122
visitNodes(node.modifiers, visitor, isModifierLike),
11281123
node.name,
11291124
/*typeParameters*/ undefined,
@@ -1208,8 +1203,6 @@ namespace ts {
12081203

12091204
if (!shouldTransformPrivateElementsOrClassStaticBlocks && some(pendingExpressions)) {
12101205
members.push(factory.createClassStaticBlockDeclaration(
1211-
/*decorators*/ RESERVED,
1212-
/*modifiers*/ RESERVED,
12131206
factory.createBlock([
12141207
factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))
12151208
])
@@ -1265,7 +1258,6 @@ namespace ts {
12651258
setOriginalNode(
12661259
setTextRange(
12671260
factory.createConstructorDeclaration(
1268-
/*decorators*/ RESERVED,
12691261
/*modifiers*/ undefined,
12701262
parameters ?? [],
12711263
body

0 commit comments

Comments
 (0)