Skip to content

Commit

Permalink
Rename SyntaxKind.Parameter to SyntaxKind.ParameterDeclaration
Browse files Browse the repository at this point in the history
  • Loading branch information
jakebailey committed Mar 19, 2024
1 parent 9219b2b commit c4104c8
Show file tree
Hide file tree
Showing 53 changed files with 134 additions and 134 deletions.
6 changes: 3 additions & 3 deletions src/compiler/binder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ function createBinder(): (file: SourceFile, options: CompilerOptions) => void {
break;
case SyntaxKind.JSDocFunctionType:
return (isJSDocConstructSignature(node) ? InternalSymbolName.New : InternalSymbolName.Call);
case SyntaxKind.Parameter:
case SyntaxKind.ParameterDeclaration:
// Parameters with names are handled at the top of this function. Parameters
// without names can only come from JSDocFunctionTypes.
Debug.assert(node.parent.kind === SyntaxKind.JSDocFunctionType, "Impossible parameter parent kind", () => `parent is: ${Debug.formatSyntaxKind(node.parent.kind)}, expected JSDocFunctionType`);
Expand Down Expand Up @@ -1193,7 +1193,7 @@ function createBinder(): (file: SourceFile, options: CompilerOptions) => void {
case SyntaxKind.BindingElement:
bindBindingElementFlow(node as BindingElement);
break;
case SyntaxKind.Parameter:
case SyntaxKind.ParameterDeclaration:
bindParameterFlow(node as ParameterDeclaration);
break;
case SyntaxKind.ObjectLiteralExpression:
Expand Down Expand Up @@ -2859,7 +2859,7 @@ function createBinder(): (file: SourceFile, options: CompilerOptions) => void {
break; // Binding the children will handle everything
case SyntaxKind.TypeParameter:
return bindTypeParameter(node as TypeParameterDeclaration);
case SyntaxKind.Parameter:
case SyntaxKind.ParameterDeclaration:
return bindParameter(node as ParameterDeclaration);
case SyntaxKind.VariableDeclaration:
return bindVariableDeclarationOrBindingElement(node as VariableDeclaration);
Expand Down
74 changes: 37 additions & 37 deletions src/compiler/checker.ts

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/compiler/emitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1529,7 +1529,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri
// Signature elements
case SyntaxKind.TypeParameter:
return emitTypeParameter(node as TypeParameterDeclaration);
case SyntaxKind.Parameter:
case SyntaxKind.ParameterDeclaration:
return emitParameter(node as ParameterDeclaration);
case SyntaxKind.Decorator:
return emitDecorator(node as Decorator);
Expand Down Expand Up @@ -5253,7 +5253,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri
forEach((node as VariableDeclarationList).declarations, generateNames);
break;
case SyntaxKind.VariableDeclaration:
case SyntaxKind.Parameter:
case SyntaxKind.ParameterDeclaration:
case SyntaxKind.BindingElement:
case SyntaxKind.ClassDeclaration:
generateNameIfNeeded((node as NamedDeclaration).name);
Expand Down
4 changes: 2 additions & 2 deletions src/compiler/factory/nodeFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1643,7 +1643,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode
type?: TypeNode,
initializer?: Expression,
) {
const node = createBaseDeclaration<ParameterDeclaration>(SyntaxKind.Parameter);
const node = createBaseDeclaration<ParameterDeclaration>(SyntaxKind.ParameterDeclaration);
node.modifiers = asNodeArray(modifiers);
node.dotDotDotToken = dotDotDotToken;
node.name = asName(name);
Expand Down Expand Up @@ -7283,7 +7283,7 @@ export function getTransformFlagsSubtreeExclusions(kind: SyntaxKind) {
return TransformFlags.ArrayLiteralOrCallOrNewExcludes;
case SyntaxKind.ModuleDeclaration:
return TransformFlags.ModuleExcludes;
case SyntaxKind.Parameter:
case SyntaxKind.ParameterDeclaration:
return TransformFlags.ParameterExcludes;
case SyntaxKind.ArrowFunction:
return TransformFlags.ArrowFunctionExcludes;
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/factory/nodeTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ export function isTypeParameterDeclaration(node: Node): node is TypeParameterDec
}

export function isParameterDeclaration(node: Node): node is ParameterDeclaration {
return node.kind === SyntaxKind.Parameter;
return node.kind === SyntaxKind.ParameterDeclaration;
}

export function isDecorator(node: Node): node is Decorator {
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/factory/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,7 @@ export function getTargetOfBindingOrAssignmentElement(bindingElement: BindingOrA
*/
export function getRestIndicatorOfBindingOrAssignmentElement(bindingElement: BindingOrAssignmentElement): BindingOrAssignmentElementRestIndicator | undefined {
switch (bindingElement.kind) {
case SyntaxKind.Parameter:
case SyntaxKind.ParameterDeclaration:
case SyntaxKind.BindingElement:
// `...` in `let [...a] = ...`
return bindingElement.dotDotDotToken;
Expand Down
4 changes: 2 additions & 2 deletions src/compiler/factory/utilitiesPublic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function setTextRange<T extends TextRange>(range: T, location: TextRange
export function canHaveModifiers(node: Node): node is HasModifiers {
const kind = node.kind;
return kind === SyntaxKind.TypeParameter
|| kind === SyntaxKind.Parameter
|| kind === SyntaxKind.ParameterDeclaration
|| kind === SyntaxKind.PropertySignature
|| kind === SyntaxKind.PropertyDeclaration
|| kind === SyntaxKind.MethodSignature
Expand Down Expand Up @@ -42,7 +42,7 @@ export function canHaveModifiers(node: Node): node is HasModifiers {

export function canHaveDecorators(node: Node): node is HasDecorators {
const kind = node.kind;
return kind === SyntaxKind.Parameter
return kind === SyntaxKind.ParameterDeclaration
|| kind === SyntaxKind.PropertyDeclaration
|| kind === SyntaxKind.MethodDeclaration
|| kind === SyntaxKind.GetAccessor
Expand Down
4 changes: 2 additions & 2 deletions src/compiler/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ const forEachChildTable: ForEachChildTable = {
[SyntaxKind.SpreadAssignment]: function forEachChildInSpreadAssignment<T>(node: SpreadAssignment, cbNode: (node: Node) => T | undefined, _cbNodes?: (nodes: NodeArray<Node>) => T | undefined): T | undefined {
return visitNode(cbNode, node.expression);
},
[SyntaxKind.Parameter]: function forEachChildInParameter<T>(node: ParameterDeclaration, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray<Node>) => T | undefined): T | undefined {
[SyntaxKind.ParameterDeclaration]: function forEachChildInParameter<T>(node: ParameterDeclaration, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray<Node>) => T | undefined): T | undefined {
return visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.dotDotDotToken) ||
visitNode(cbNode, node.name) ||
Expand Down Expand Up @@ -3364,7 +3364,7 @@ namespace Parser {
}

function isReusableParameter(node: Node) {
if (node.kind !== SyntaxKind.Parameter) {
if (node.kind !== SyntaxKind.ParameterDeclaration) {
return false;
}

Expand Down
4 changes: 2 additions & 2 deletions src/compiler/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2983,7 +2983,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg
// Otherwise break to visit each child

switch (parent.kind) {
case SyntaxKind.Parameter:
case SyntaxKind.ParameterDeclaration:
case SyntaxKind.PropertyDeclaration:
case SyntaxKind.MethodDeclaration:
if ((parent as ParameterDeclaration | PropertyDeclaration | MethodDeclaration).questionToken === node) {
Expand Down Expand Up @@ -3157,7 +3157,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg
return "skip";
}
break;
case SyntaxKind.Parameter:
case SyntaxKind.ParameterDeclaration:
// Check modifiers of parameter declaration
if (nodes === (parent as ParameterDeclaration).modifiers && some(nodes, isModifier)) {
diagnostics.push(createDiagnosticForNodeArray(nodes, Diagnostics.Parameter_modifiers_can_only_be_used_in_TypeScript_files));
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/transformers/classFields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ export function transformClassFields(context: TransformationContext): (x: Source
return visitVariableStatement(node as VariableStatement);
case SyntaxKind.VariableDeclaration:
return visitVariableDeclaration(node as VariableDeclaration);
case SyntaxKind.Parameter:
case SyntaxKind.ParameterDeclaration:
return visitParameterDeclaration(node as ParameterDeclaration);
case SyntaxKind.BindingElement:
return visitBindingElement(node as BindingElement);
Expand Down
6 changes: 3 additions & 3 deletions src/compiler/transformers/declarations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ export function transformDeclarations(context: TransformationContext) {
// Literal const declarations will have an initializer ensured rather than a type
return;
}
const shouldAddImplicitUndefined = node.kind === SyntaxKind.Parameter && resolver.requiresAddingImplicitUndefined(node);
const shouldAddImplicitUndefined = node.kind === SyntaxKind.ParameterDeclaration && resolver.requiresAddingImplicitUndefined(node);
if (type && !shouldAddImplicitUndefined) {
return visitNode(type, visitDeclarationSubtree, isTypeNode);
}
Expand All @@ -736,7 +736,7 @@ export function transformDeclarations(context: TransformationContext) {
}
let typeNode;
switch (node.kind) {
case SyntaxKind.Parameter:
case SyntaxKind.ParameterDeclaration:
case SyntaxKind.PropertySignature:
case SyntaxKind.PropertyDeclaration:
case SyntaxKind.BindingElement:
Expand Down Expand Up @@ -1940,7 +1940,7 @@ function canHaveLiteralInitializer(node: Node): boolean {
case SyntaxKind.PropertyDeclaration:
case SyntaxKind.PropertySignature:
return !hasEffectiveModifier(node, ModifierFlags.Private);
case SyntaxKind.Parameter:
case SyntaxKind.ParameterDeclaration:
case SyntaxKind.VariableDeclaration:
return true;
}
Expand Down
4 changes: 2 additions & 2 deletions src/compiler/transformers/declarations/diagnostics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ export function createGetSymbolAccessibilityDiagnosticForNode(node: DeclarationD
// The only exception here is if the constructor was marked as private. we are not emitting the constructor parameters at all.
else if (
node.kind === SyntaxKind.PropertyDeclaration || node.kind === SyntaxKind.PropertyAccessExpression || node.kind === SyntaxKind.ElementAccessExpression || node.kind === SyntaxKind.BinaryExpression || node.kind === SyntaxKind.PropertySignature ||
(node.kind === SyntaxKind.Parameter && hasSyntacticModifier(node.parent, ModifierFlags.Private))
(node.kind === SyntaxKind.ParameterDeclaration && hasSyntacticModifier(node.parent, ModifierFlags.Private))
) {
// TODO(jfreeman): Deal with computed properties in error reporting.
if (isStatic(node)) {
Expand All @@ -257,7 +257,7 @@ export function createGetSymbolAccessibilityDiagnosticForNode(node: DeclarationD
Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1;
}
else if (node.parent.kind === SyntaxKind.ClassDeclaration || node.kind === SyntaxKind.Parameter) {
else if (node.parent.kind === SyntaxKind.ClassDeclaration || node.kind === SyntaxKind.ParameterDeclaration) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/transformers/es2015.ts
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ export function transformES2015(context: TransformationContext): (x: SourceFile
case SyntaxKind.ClassExpression:
return visitClassExpression(node as ClassExpression);

case SyntaxKind.Parameter:
case SyntaxKind.ParameterDeclaration:
return visitParameter(node as ParameterDeclaration);

case SyntaxKind.FunctionDeclaration:
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/transformers/es2017.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ export function transformES2017(context: TransformationContext): (x: SourceFile
case SyntaxKind.SetAccessor:
case SyntaxKind.Constructor:
return node;
case SyntaxKind.Parameter:
case SyntaxKind.ParameterDeclaration:
case SyntaxKind.BindingElement:
case SyntaxKind.VariableDeclaration:
break;
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/transformers/es2018.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ export function transformES2018(context: TransformationContext): (x: SourceFile
HierarchyFacts.ArrowFunctionExcludes,
HierarchyFacts.ArrowFunctionIncludes,
);
case SyntaxKind.Parameter:
case SyntaxKind.ParameterDeclaration:
return visitParameter(node as ParameterDeclaration);
case SyntaxKind.ExpressionStatement:
return visitExpressionStatement(node as ExpressionStatement);
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/transformers/esDecorators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ export function transformESDecorators(context: TransformationContext): (x: Sourc
case SyntaxKind.PropertyDeclaration:
case SyntaxKind.ClassStaticBlockDeclaration:
return Debug.fail("Not supported outside of a class. Use 'classElementVisitor' instead.");
case SyntaxKind.Parameter:
case SyntaxKind.ParameterDeclaration:
return visitParameterDeclaration(node as ParameterDeclaration);

// Support NamedEvaluation to ensure the correct class name for class expressions.
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/transformers/legacyDecorators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export function transformLegacyDecorators(context: TransformationContext): (x: S
return visitGetAccessorDeclaration(node as GetAccessorDeclaration);
case SyntaxKind.PropertyDeclaration:
return visitPropertyDeclaration(node as PropertyDeclaration);
case SyntaxKind.Parameter:
case SyntaxKind.ParameterDeclaration:
return visitParameterDeclaration(node as ParameterDeclaration);
default:
return visitEachChild(node, visitor, context);
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/transformers/namedEvaluation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ export function transformNamedEvaluation(context: TransformationContext, node: N
return transformNamedEvaluationOfShorthandAssignmentProperty(context, node, ignoreEmptyStringLiteral, assignedName);
case SyntaxKind.VariableDeclaration:
return transformNamedEvaluationOfVariableDeclaration(context, node, ignoreEmptyStringLiteral, assignedName);
case SyntaxKind.Parameter:
case SyntaxKind.ParameterDeclaration:
return transformNamedEvaluationOfParameterDeclaration(context, node, ignoreEmptyStringLiteral, assignedName);
case SyntaxKind.BindingElement:
return transformNamedEvaluationOfBindingElement(context, node, ignoreEmptyStringLiteral, assignedName);
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/transformers/ts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ export function transformTypeScript(context: TransformationContext) {
// TypeScript arrow functions can have modifiers and type annotations.
return visitArrowFunction(node as ArrowFunction);

case SyntaxKind.Parameter:
case SyntaxKind.ParameterDeclaration:
// This may be a parameter declaration with TypeScript syntax extensions.
//
// TypeScript parameter declaration syntax extensions include:
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/transformers/typeSerializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export function createRuntimeTypeSerializer(context: TransformationContext): Run
function serializeTypeOfNode(node: PropertyDeclaration | ParameterDeclaration | AccessorDeclaration | ClassLikeDeclaration | MethodDeclaration): SerializedTypeNode {
switch (node.kind) {
case SyntaxKind.PropertyDeclaration:
case SyntaxKind.Parameter:
case SyntaxKind.ParameterDeclaration:
return serializeTypeNode(node.type);
case SyntaxKind.SetAccessor:
case SyntaxKind.GetAccessor:
Expand Down
4 changes: 2 additions & 2 deletions src/compiler/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ export const enum SyntaxKind {
ComputedPropertyName,
// Signature elements
TypeParameter,
Parameter,
ParameterDeclaration,
Decorator,
// TypeMember
PropertySignature,
Expand Down Expand Up @@ -1856,7 +1856,7 @@ export interface VariableDeclarationList extends Node {

// dprint-ignore
export interface ParameterDeclaration extends NamedDeclaration, JSDocContainer {
readonly kind: SyntaxKind.Parameter;
readonly kind: SyntaxKind.ParameterDeclaration;
readonly parent: SignatureDeclaration;
readonly modifiers?: NodeArray<ModifierLike>;
readonly dotDotDotToken?: DotDotDotToken; // Present on rest parameter
Expand Down
Loading

0 comments on commit c4104c8

Please sign in to comment.