Skip to content

Commit c4104c8

Browse files
committed
Rename SyntaxKind.Parameter to SyntaxKind.ParameterDeclaration
1 parent 9219b2b commit c4104c8

Some content is hidden

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

53 files changed

+134
-134
lines changed

src/compiler/binder.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ function createBinder(): (file: SourceFile, options: CompilerOptions) => void {
724724
break;
725725
case SyntaxKind.JSDocFunctionType:
726726
return (isJSDocConstructSignature(node) ? InternalSymbolName.New : InternalSymbolName.Call);
727-
case SyntaxKind.Parameter:
727+
case SyntaxKind.ParameterDeclaration:
728728
// Parameters with names are handled at the top of this function. Parameters
729729
// without names can only come from JSDocFunctionTypes.
730730
Debug.assert(node.parent.kind === SyntaxKind.JSDocFunctionType, "Impossible parameter parent kind", () => `parent is: ${Debug.formatSyntaxKind(node.parent.kind)}, expected JSDocFunctionType`);
@@ -1193,7 +1193,7 @@ function createBinder(): (file: SourceFile, options: CompilerOptions) => void {
11931193
case SyntaxKind.BindingElement:
11941194
bindBindingElementFlow(node as BindingElement);
11951195
break;
1196-
case SyntaxKind.Parameter:
1196+
case SyntaxKind.ParameterDeclaration:
11971197
bindParameterFlow(node as ParameterDeclaration);
11981198
break;
11991199
case SyntaxKind.ObjectLiteralExpression:
@@ -2859,7 +2859,7 @@ function createBinder(): (file: SourceFile, options: CompilerOptions) => void {
28592859
break; // Binding the children will handle everything
28602860
case SyntaxKind.TypeParameter:
28612861
return bindTypeParameter(node as TypeParameterDeclaration);
2862-
case SyntaxKind.Parameter:
2862+
case SyntaxKind.ParameterDeclaration:
28632863
return bindParameter(node as ParameterDeclaration);
28642864
case SyntaxKind.VariableDeclaration:
28652865
return bindVariableDeclarationOrBindingElement(node as VariableDeclaration);

src/compiler/checker.ts

Lines changed: 37 additions & 37 deletions
Large diffs are not rendered by default.

src/compiler/emitter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1529,7 +1529,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri
15291529
// Signature elements
15301530
case SyntaxKind.TypeParameter:
15311531
return emitTypeParameter(node as TypeParameterDeclaration);
1532-
case SyntaxKind.Parameter:
1532+
case SyntaxKind.ParameterDeclaration:
15331533
return emitParameter(node as ParameterDeclaration);
15341534
case SyntaxKind.Decorator:
15351535
return emitDecorator(node as Decorator);
@@ -5253,7 +5253,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri
52535253
forEach((node as VariableDeclarationList).declarations, generateNames);
52545254
break;
52555255
case SyntaxKind.VariableDeclaration:
5256-
case SyntaxKind.Parameter:
5256+
case SyntaxKind.ParameterDeclaration:
52575257
case SyntaxKind.BindingElement:
52585258
case SyntaxKind.ClassDeclaration:
52595259
generateNameIfNeeded((node as NamedDeclaration).name);

src/compiler/factory/nodeFactory.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1643,7 +1643,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode
16431643
type?: TypeNode,
16441644
initializer?: Expression,
16451645
) {
1646-
const node = createBaseDeclaration<ParameterDeclaration>(SyntaxKind.Parameter);
1646+
const node = createBaseDeclaration<ParameterDeclaration>(SyntaxKind.ParameterDeclaration);
16471647
node.modifiers = asNodeArray(modifiers);
16481648
node.dotDotDotToken = dotDotDotToken;
16491649
node.name = asName(name);
@@ -7283,7 +7283,7 @@ export function getTransformFlagsSubtreeExclusions(kind: SyntaxKind) {
72837283
return TransformFlags.ArrayLiteralOrCallOrNewExcludes;
72847284
case SyntaxKind.ModuleDeclaration:
72857285
return TransformFlags.ModuleExcludes;
7286-
case SyntaxKind.Parameter:
7286+
case SyntaxKind.ParameterDeclaration:
72877287
return TransformFlags.ParameterExcludes;
72887288
case SyntaxKind.ArrowFunction:
72897289
return TransformFlags.ArrowFunctionExcludes;

src/compiler/factory/nodeTests.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ export function isTypeParameterDeclaration(node: Node): node is TypeParameterDec
403403
}
404404

405405
export function isParameterDeclaration(node: Node): node is ParameterDeclaration {
406-
return node.kind === SyntaxKind.Parameter;
406+
return node.kind === SyntaxKind.ParameterDeclaration;
407407
}
408408

409409
export function isDecorator(node: Node): node is Decorator {

src/compiler/factory/utilities.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -998,7 +998,7 @@ export function getTargetOfBindingOrAssignmentElement(bindingElement: BindingOrA
998998
*/
999999
export function getRestIndicatorOfBindingOrAssignmentElement(bindingElement: BindingOrAssignmentElement): BindingOrAssignmentElementRestIndicator | undefined {
10001000
switch (bindingElement.kind) {
1001-
case SyntaxKind.Parameter:
1001+
case SyntaxKind.ParameterDeclaration:
10021002
case SyntaxKind.BindingElement:
10031003
// `...` in `let [...a] = ...`
10041004
return bindingElement.dotDotDotToken;

src/compiler/factory/utilitiesPublic.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export function setTextRange<T extends TextRange>(range: T, location: TextRange
1414
export function canHaveModifiers(node: Node): node is HasModifiers {
1515
const kind = node.kind;
1616
return kind === SyntaxKind.TypeParameter
17-
|| kind === SyntaxKind.Parameter
17+
|| kind === SyntaxKind.ParameterDeclaration
1818
|| kind === SyntaxKind.PropertySignature
1919
|| kind === SyntaxKind.PropertyDeclaration
2020
|| kind === SyntaxKind.MethodSignature
@@ -42,7 +42,7 @@ export function canHaveModifiers(node: Node): node is HasModifiers {
4242

4343
export function canHaveDecorators(node: Node): node is HasDecorators {
4444
const kind = node.kind;
45-
return kind === SyntaxKind.Parameter
45+
return kind === SyntaxKind.ParameterDeclaration
4646
|| kind === SyntaxKind.PropertyDeclaration
4747
|| kind === SyntaxKind.MethodDeclaration
4848
|| kind === SyntaxKind.GetAccessor

src/compiler/parser.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ const forEachChildTable: ForEachChildTable = {
519519
[SyntaxKind.SpreadAssignment]: function forEachChildInSpreadAssignment<T>(node: SpreadAssignment, cbNode: (node: Node) => T | undefined, _cbNodes?: (nodes: NodeArray<Node>) => T | undefined): T | undefined {
520520
return visitNode(cbNode, node.expression);
521521
},
522-
[SyntaxKind.Parameter]: function forEachChildInParameter<T>(node: ParameterDeclaration, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray<Node>) => T | undefined): T | undefined {
522+
[SyntaxKind.ParameterDeclaration]: function forEachChildInParameter<T>(node: ParameterDeclaration, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray<Node>) => T | undefined): T | undefined {
523523
return visitNodes(cbNode, cbNodes, node.modifiers) ||
524524
visitNode(cbNode, node.dotDotDotToken) ||
525525
visitNode(cbNode, node.name) ||
@@ -3364,7 +3364,7 @@ namespace Parser {
33643364
}
33653365

33663366
function isReusableParameter(node: Node) {
3367-
if (node.kind !== SyntaxKind.Parameter) {
3367+
if (node.kind !== SyntaxKind.ParameterDeclaration) {
33683368
return false;
33693369
}
33703370

src/compiler/program.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2983,7 +2983,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg
29832983
// Otherwise break to visit each child
29842984

29852985
switch (parent.kind) {
2986-
case SyntaxKind.Parameter:
2986+
case SyntaxKind.ParameterDeclaration:
29872987
case SyntaxKind.PropertyDeclaration:
29882988
case SyntaxKind.MethodDeclaration:
29892989
if ((parent as ParameterDeclaration | PropertyDeclaration | MethodDeclaration).questionToken === node) {
@@ -3157,7 +3157,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg
31573157
return "skip";
31583158
}
31593159
break;
3160-
case SyntaxKind.Parameter:
3160+
case SyntaxKind.ParameterDeclaration:
31613161
// Check modifiers of parameter declaration
31623162
if (nodes === (parent as ParameterDeclaration).modifiers && some(nodes, isModifier)) {
31633163
diagnostics.push(createDiagnosticForNodeArray(nodes, Diagnostics.Parameter_modifiers_can_only_be_used_in_TypeScript_files));

src/compiler/transformers/classFields.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ export function transformClassFields(context: TransformationContext): (x: Source
479479
return visitVariableStatement(node as VariableStatement);
480480
case SyntaxKind.VariableDeclaration:
481481
return visitVariableDeclaration(node as VariableDeclaration);
482-
case SyntaxKind.Parameter:
482+
case SyntaxKind.ParameterDeclaration:
483483
return visitParameterDeclaration(node as ParameterDeclaration);
484484
case SyntaxKind.BindingElement:
485485
return visitBindingElement(node as BindingElement);

src/compiler/transformers/declarations.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,7 @@ export function transformDeclarations(context: TransformationContext) {
723723
// Literal const declarations will have an initializer ensured rather than a type
724724
return;
725725
}
726-
const shouldAddImplicitUndefined = node.kind === SyntaxKind.Parameter && resolver.requiresAddingImplicitUndefined(node);
726+
const shouldAddImplicitUndefined = node.kind === SyntaxKind.ParameterDeclaration && resolver.requiresAddingImplicitUndefined(node);
727727
if (type && !shouldAddImplicitUndefined) {
728728
return visitNode(type, visitDeclarationSubtree, isTypeNode);
729729
}
@@ -736,7 +736,7 @@ export function transformDeclarations(context: TransformationContext) {
736736
}
737737
let typeNode;
738738
switch (node.kind) {
739-
case SyntaxKind.Parameter:
739+
case SyntaxKind.ParameterDeclaration:
740740
case SyntaxKind.PropertySignature:
741741
case SyntaxKind.PropertyDeclaration:
742742
case SyntaxKind.BindingElement:
@@ -1940,7 +1940,7 @@ function canHaveLiteralInitializer(node: Node): boolean {
19401940
case SyntaxKind.PropertyDeclaration:
19411941
case SyntaxKind.PropertySignature:
19421942
return !hasEffectiveModifier(node, ModifierFlags.Private);
1943-
case SyntaxKind.Parameter:
1943+
case SyntaxKind.ParameterDeclaration:
19441944
case SyntaxKind.VariableDeclaration:
19451945
return true;
19461946
}

src/compiler/transformers/declarations/diagnostics.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ export function createGetSymbolAccessibilityDiagnosticForNode(node: DeclarationD
247247
// The only exception here is if the constructor was marked as private. we are not emitting the constructor parameters at all.
248248
else if (
249249
node.kind === SyntaxKind.PropertyDeclaration || node.kind === SyntaxKind.PropertyAccessExpression || node.kind === SyntaxKind.ElementAccessExpression || node.kind === SyntaxKind.BinaryExpression || node.kind === SyntaxKind.PropertySignature ||
250-
(node.kind === SyntaxKind.Parameter && hasSyntacticModifier(node.parent, ModifierFlags.Private))
250+
(node.kind === SyntaxKind.ParameterDeclaration && hasSyntacticModifier(node.parent, ModifierFlags.Private))
251251
) {
252252
// TODO(jfreeman): Deal with computed properties in error reporting.
253253
if (isStatic(node)) {
@@ -257,7 +257,7 @@ export function createGetSymbolAccessibilityDiagnosticForNode(node: DeclarationD
257257
Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
258258
Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1;
259259
}
260-
else if (node.parent.kind === SyntaxKind.ClassDeclaration || node.kind === SyntaxKind.Parameter) {
260+
else if (node.parent.kind === SyntaxKind.ClassDeclaration || node.kind === SyntaxKind.ParameterDeclaration) {
261261
return symbolAccessibilityResult.errorModuleName ?
262262
symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
263263
Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :

src/compiler/transformers/es2015.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ export function transformES2015(context: TransformationContext): (x: SourceFile
640640
case SyntaxKind.ClassExpression:
641641
return visitClassExpression(node as ClassExpression);
642642

643-
case SyntaxKind.Parameter:
643+
case SyntaxKind.ParameterDeclaration:
644644
return visitParameter(node as ParameterDeclaration);
645645

646646
case SyntaxKind.FunctionDeclaration:

src/compiler/transformers/es2017.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ export function transformES2017(context: TransformationContext): (x: SourceFile
216216
case SyntaxKind.SetAccessor:
217217
case SyntaxKind.Constructor:
218218
return node;
219-
case SyntaxKind.Parameter:
219+
case SyntaxKind.ParameterDeclaration:
220220
case SyntaxKind.BindingElement:
221221
case SyntaxKind.VariableDeclaration:
222222
break;

src/compiler/transformers/es2018.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ export function transformES2018(context: TransformationContext): (x: SourceFile
360360
HierarchyFacts.ArrowFunctionExcludes,
361361
HierarchyFacts.ArrowFunctionIncludes,
362362
);
363-
case SyntaxKind.Parameter:
363+
case SyntaxKind.ParameterDeclaration:
364364
return visitParameter(node as ParameterDeclaration);
365365
case SyntaxKind.ExpressionStatement:
366366
return visitExpressionStatement(node as ExpressionStatement);

src/compiler/transformers/esDecorators.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc
436436
case SyntaxKind.PropertyDeclaration:
437437
case SyntaxKind.ClassStaticBlockDeclaration:
438438
return Debug.fail("Not supported outside of a class. Use 'classElementVisitor' instead.");
439-
case SyntaxKind.Parameter:
439+
case SyntaxKind.ParameterDeclaration:
440440
return visitParameterDeclaration(node as ParameterDeclaration);
441441

442442
// Support NamedEvaluation to ensure the correct class name for class expressions.

src/compiler/transformers/legacyDecorators.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ export function transformLegacyDecorators(context: TransformationContext): (x: S
143143
return visitGetAccessorDeclaration(node as GetAccessorDeclaration);
144144
case SyntaxKind.PropertyDeclaration:
145145
return visitPropertyDeclaration(node as PropertyDeclaration);
146-
case SyntaxKind.Parameter:
146+
case SyntaxKind.ParameterDeclaration:
147147
return visitParameterDeclaration(node as ParameterDeclaration);
148148
default:
149149
return visitEachChild(node, visitor, context);

src/compiler/transformers/namedEvaluation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ export function transformNamedEvaluation(context: TransformationContext, node: N
477477
return transformNamedEvaluationOfShorthandAssignmentProperty(context, node, ignoreEmptyStringLiteral, assignedName);
478478
case SyntaxKind.VariableDeclaration:
479479
return transformNamedEvaluationOfVariableDeclaration(context, node, ignoreEmptyStringLiteral, assignedName);
480-
case SyntaxKind.Parameter:
480+
case SyntaxKind.ParameterDeclaration:
481481
return transformNamedEvaluationOfParameterDeclaration(context, node, ignoreEmptyStringLiteral, assignedName);
482482
case SyntaxKind.BindingElement:
483483
return transformNamedEvaluationOfBindingElement(context, node, ignoreEmptyStringLiteral, assignedName);

src/compiler/transformers/ts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ export function transformTypeScript(context: TransformationContext) {
769769
// TypeScript arrow functions can have modifiers and type annotations.
770770
return visitArrowFunction(node as ArrowFunction);
771771

772-
case SyntaxKind.Parameter:
772+
case SyntaxKind.ParameterDeclaration:
773773
// This may be a parameter declaration with TypeScript syntax extensions.
774774
//
775775
// TypeScript parameter declaration syntax extensions include:

src/compiler/transformers/typeSerializer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ export function createRuntimeTypeSerializer(context: TransformationContext): Run
179179
function serializeTypeOfNode(node: PropertyDeclaration | ParameterDeclaration | AccessorDeclaration | ClassLikeDeclaration | MethodDeclaration): SerializedTypeNode {
180180
switch (node.kind) {
181181
case SyntaxKind.PropertyDeclaration:
182-
case SyntaxKind.Parameter:
182+
case SyntaxKind.ParameterDeclaration:
183183
return serializeTypeNode(node.type);
184184
case SyntaxKind.SetAccessor:
185185
case SyntaxKind.GetAccessor:

src/compiler/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ export const enum SyntaxKind {
231231
ComputedPropertyName,
232232
// Signature elements
233233
TypeParameter,
234-
Parameter,
234+
ParameterDeclaration,
235235
Decorator,
236236
// TypeMember
237237
PropertySignature,
@@ -1856,7 +1856,7 @@ export interface VariableDeclarationList extends Node {
18561856

18571857
// dprint-ignore
18581858
export interface ParameterDeclaration extends NamedDeclaration, JSDocContainer {
1859-
readonly kind: SyntaxKind.Parameter;
1859+
readonly kind: SyntaxKind.ParameterDeclaration;
18601860
readonly parent: SignatureDeclaration;
18611861
readonly modifiers?: NodeArray<ModifierLike>;
18621862
readonly dotDotDotToken?: DotDotDotToken; // Present on rest parameter

0 commit comments

Comments
 (0)