Skip to content

Commit

Permalink
Add typeParameters to tagged template visitor keys (#13500)
Browse files Browse the repository at this point in the history
* refactor: move ES2022 AST nodes to core

* fix: add typeParameters to visitor keys

* chore: update artifacts

* fix: add typeAnnotation to visitor keys
  • Loading branch information
JLHwung committed Jun 22, 2021
1 parent 5ac5e35 commit 3840893
Show file tree
Hide file tree
Showing 8 changed files with 329 additions and 332 deletions.
60 changes: 30 additions & 30 deletions packages/babel-types/src/asserts/generated/index.ts
Expand Up @@ -500,6 +500,30 @@ export function assertOptionalCallExpression(
): asserts node is t.OptionalCallExpression {
assert("OptionalCallExpression", node, opts);
}
export function assertClassProperty(
node: object | null | undefined,
opts?: object | null,
): asserts node is t.ClassProperty {
assert("ClassProperty", node, opts);
}
export function assertClassPrivateProperty(
node: object | null | undefined,
opts?: object | null,
): asserts node is t.ClassPrivateProperty {
assert("ClassPrivateProperty", node, opts);
}
export function assertClassPrivateMethod(
node: object | null | undefined,
opts?: object | null,
): asserts node is t.ClassPrivateMethod {
assert("ClassPrivateMethod", node, opts);
}
export function assertPrivateName(
node: object | null | undefined,
opts?: object | null,
): asserts node is t.PrivateName {
assert("PrivateName", node, opts);
}
export function assertAnyTypeAnnotation(
node: object | null | undefined,
opts?: object | null,
Expand Down Expand Up @@ -1010,12 +1034,6 @@ export function assertBindExpression(
): asserts node is t.BindExpression {
assert("BindExpression", node, opts);
}
export function assertClassProperty(
node: object | null | undefined,
opts?: object | null,
): asserts node is t.ClassProperty {
assert("ClassProperty", node, opts);
}
export function assertPipelineTopicExpression(
node: object | null | undefined,
opts?: object | null,
Expand All @@ -1034,18 +1052,6 @@ export function assertPipelinePrimaryTopicReference(
): asserts node is t.PipelinePrimaryTopicReference {
assert("PipelinePrimaryTopicReference", node, opts);
}
export function assertClassPrivateProperty(
node: object | null | undefined,
opts?: object | null,
): asserts node is t.ClassPrivateProperty {
assert("ClassPrivateProperty", node, opts);
}
export function assertClassPrivateMethod(
node: object | null | undefined,
opts?: object | null,
): asserts node is t.ClassPrivateMethod {
assert("ClassPrivateMethod", node, opts);
}
export function assertImportAttribute(
node: object | null | undefined,
opts?: object | null,
Expand All @@ -1070,12 +1076,6 @@ export function assertExportDefaultSpecifier(
): asserts node is t.ExportDefaultSpecifier {
assert("ExportDefaultSpecifier", node, opts);
}
export function assertPrivateName(
node: object | null | undefined,
opts?: object | null,
): asserts node is t.PrivateName {
assert("PrivateName", node, opts);
}
export function assertRecordExpression(
node: object | null | undefined,
opts?: object | null,
Expand Down Expand Up @@ -1682,6 +1682,12 @@ export function assertModuleSpecifier(
): asserts node is t.ModuleSpecifier {
assert("ModuleSpecifier", node, opts);
}
export function assertPrivate(
node: object | null | undefined,
opts?: object | null,
): asserts node is t.Private {
assert("Private", node, opts);
}
export function assertFlow(
node: object | null | undefined,
opts?: object | null,
Expand Down Expand Up @@ -1730,12 +1736,6 @@ export function assertJSX(
): asserts node is t.JSX {
assert("JSX", node, opts);
}
export function assertPrivate(
node: object | null | undefined,
opts?: object | null,
): asserts node is t.Private {
assert("Private", node, opts);
}
export function assertTSTypeElement(
node: object | null | undefined,
opts?: object | null,
Expand Down
114 changes: 57 additions & 57 deletions packages/babel-types/src/ast-types/generated/index.ts
Expand Up @@ -1009,6 +1009,61 @@ export interface OptionalCallExpression extends BaseNode {
typeParameters?: TSTypeParameterInstantiation | null;
}

export interface ClassProperty extends BaseNode {
type: "ClassProperty";
key: Identifier | StringLiteral | NumericLiteral | Expression;
value?: Expression | null;
typeAnnotation?: TypeAnnotation | TSTypeAnnotation | Noop | null;
decorators?: Array<Decorator> | null;
computed?: boolean;
static?: boolean;
abstract?: boolean | null;
accessibility?: "public" | "private" | "protected" | null;
declare?: boolean | null;
definite?: boolean | null;
optional?: boolean | null;
override?: boolean;
readonly?: boolean | null;
}

export interface ClassPrivateProperty extends BaseNode {
type: "ClassPrivateProperty";
key: PrivateName;
value?: Expression | null;
decorators?: Array<Decorator> | null;
static: any;
typeAnnotation?: TypeAnnotation | TSTypeAnnotation | Noop | null;
}

export interface ClassPrivateMethod extends BaseNode {
type: "ClassPrivateMethod";
kind?: "get" | "set" | "method" | "constructor";
key: PrivateName;
params: Array<Identifier | Pattern | RestElement | TSParameterProperty>;
body: BlockStatement;
static?: boolean;
abstract?: boolean | null;
access?: "public" | "private" | "protected" | null;
accessibility?: "public" | "private" | "protected" | null;
async?: boolean;
computed?: boolean;
decorators?: Array<Decorator> | null;
generator?: boolean;
optional?: boolean | null;
override?: boolean;
returnType?: TypeAnnotation | TSTypeAnnotation | Noop | null;
typeParameters?:
| TypeParameterDeclaration
| TSTypeParameterDeclaration
| Noop
| null;
}

export interface PrivateName extends BaseNode {
type: "PrivateName";
id: Identifier;
}

export interface AnyTypeAnnotation extends BaseNode {
type: "AnyTypeAnnotation";
}
Expand Down Expand Up @@ -1531,23 +1586,6 @@ export interface BindExpression extends BaseNode {
callee: Expression;
}

export interface ClassProperty extends BaseNode {
type: "ClassProperty";
key: Identifier | StringLiteral | NumericLiteral | Expression;
value?: Expression | null;
typeAnnotation?: TypeAnnotation | TSTypeAnnotation | Noop | null;
decorators?: Array<Decorator> | null;
computed?: boolean;
static?: boolean;
abstract?: boolean | null;
accessibility?: "public" | "private" | "protected" | null;
declare?: boolean | null;
definite?: boolean | null;
optional?: boolean | null;
override?: boolean;
readonly?: boolean | null;
}

export interface PipelineTopicExpression extends BaseNode {
type: "PipelineTopicExpression";
expression: Expression;
Expand All @@ -1562,39 +1600,6 @@ export interface PipelinePrimaryTopicReference extends BaseNode {
type: "PipelinePrimaryTopicReference";
}

export interface ClassPrivateProperty extends BaseNode {
type: "ClassPrivateProperty";
key: PrivateName;
value?: Expression | null;
decorators?: Array<Decorator> | null;
static: any;
typeAnnotation?: TypeAnnotation | TSTypeAnnotation | Noop | null;
}

export interface ClassPrivateMethod extends BaseNode {
type: "ClassPrivateMethod";
kind?: "get" | "set" | "method" | "constructor";
key: PrivateName;
params: Array<Identifier | Pattern | RestElement | TSParameterProperty>;
body: BlockStatement;
static?: boolean;
abstract?: boolean | null;
access?: "public" | "private" | "protected" | null;
accessibility?: "public" | "private" | "protected" | null;
async?: boolean;
computed?: boolean;
decorators?: Array<Decorator> | null;
generator?: boolean;
optional?: boolean | null;
override?: boolean;
returnType?: TypeAnnotation | TSTypeAnnotation | Noop | null;
typeParameters?:
| TypeParameterDeclaration
| TSTypeParameterDeclaration
| Noop
| null;
}

export interface ImportAttribute extends BaseNode {
type: "ImportAttribute";
key: Identifier | StringLiteral;
Expand All @@ -1617,11 +1622,6 @@ export interface ExportDefaultSpecifier extends BaseNode {
exported: Identifier;
}

export interface PrivateName extends BaseNode {
type: "PrivateName";
id: Identifier;
}

export interface RecordExpression extends BaseNode {
type: "RecordExpression";
properties: Array<ObjectProperty | SpreadElement>;
Expand Down Expand Up @@ -2316,6 +2316,7 @@ export type ModuleSpecifier =
| ImportSpecifier
| ExportNamespaceSpecifier
| ExportDefaultSpecifier;
export type Private = ClassPrivateProperty | ClassPrivateMethod | PrivateName;
export type Flow =
| AnyTypeAnnotation
| ArrayTypeAnnotation
Expand Down Expand Up @@ -2452,7 +2453,6 @@ export type JSX =
| JSXFragment
| JSXOpeningFragment
| JSXClosingFragment;
export type Private = ClassPrivateProperty | ClassPrivateMethod | PrivateName;
export type TSTypeElement =
| TSCallSignatureDeclaration
| TSConstructSignatureDeclaration
Expand Down Expand Up @@ -2546,6 +2546,7 @@ export interface Aliases {
ModuleDeclaration: ModuleDeclaration;
ExportDeclaration: ExportDeclaration;
ModuleSpecifier: ModuleSpecifier;
Private: Private;
Flow: Flow;
FlowType: FlowType;
FlowBaseAnnotation: FlowBaseAnnotation;
Expand All @@ -2554,7 +2555,6 @@ export interface Aliases {
EnumBody: EnumBody;
EnumMember: EnumMember;
JSX: JSX;
Private: Private;
TSTypeElement: TSTypeElement;
TSType: TSType;
TSBaseType: TSBaseType;
Expand Down
64 changes: 32 additions & 32 deletions packages/babel-types/src/builders/generated/index.ts
Expand Up @@ -515,6 +515,38 @@ export function optionalCallExpression(
): t.OptionalCallExpression {
return builder("OptionalCallExpression", ...arguments);
}
export function classProperty(
key: t.Identifier | t.StringLiteral | t.NumericLiteral | t.Expression,
value?: t.Expression | null,
typeAnnotation?: t.TypeAnnotation | t.TSTypeAnnotation | t.Noop | null,
decorators?: Array<t.Decorator> | null,
computed?: boolean,
_static?: boolean,
): t.ClassProperty {
return builder("ClassProperty", ...arguments);
}
export function classPrivateProperty(
key: t.PrivateName,
value: t.Expression | null | undefined,
decorators: Array<t.Decorator> | null | undefined,
_static: any,
): t.ClassPrivateProperty {
return builder("ClassPrivateProperty", ...arguments);
}
export function classPrivateMethod(
kind: "get" | "set" | "method" | "constructor" | undefined,
key: t.PrivateName,
params: Array<
t.Identifier | t.Pattern | t.RestElement | t.TSParameterProperty
>,
body: t.BlockStatement,
_static?: boolean,
): t.ClassPrivateMethod {
return builder("ClassPrivateMethod", ...arguments);
}
export function privateName(id: t.Identifier): t.PrivateName {
return builder("PrivateName", ...arguments);
}
export function anyTypeAnnotation(): t.AnyTypeAnnotation {
return builder("AnyTypeAnnotation", ...arguments);
}
Expand Down Expand Up @@ -992,16 +1024,6 @@ export function bindExpression(
): t.BindExpression {
return builder("BindExpression", ...arguments);
}
export function classProperty(
key: t.Identifier | t.StringLiteral | t.NumericLiteral | t.Expression,
value?: t.Expression | null,
typeAnnotation?: t.TypeAnnotation | t.TSTypeAnnotation | t.Noop | null,
decorators?: Array<t.Decorator> | null,
computed?: boolean,
_static?: boolean,
): t.ClassProperty {
return builder("ClassProperty", ...arguments);
}
export function pipelineTopicExpression(
expression: t.Expression,
): t.PipelineTopicExpression {
Expand All @@ -1015,25 +1037,6 @@ export function pipelineBareFunction(
export function pipelinePrimaryTopicReference(): t.PipelinePrimaryTopicReference {
return builder("PipelinePrimaryTopicReference", ...arguments);
}
export function classPrivateProperty(
key: t.PrivateName,
value: t.Expression | null | undefined,
decorators: Array<t.Decorator> | null | undefined,
_static: any,
): t.ClassPrivateProperty {
return builder("ClassPrivateProperty", ...arguments);
}
export function classPrivateMethod(
kind: "get" | "set" | "method" | "constructor" | undefined,
key: t.PrivateName,
params: Array<
t.Identifier | t.Pattern | t.RestElement | t.TSParameterProperty
>,
body: t.BlockStatement,
_static?: boolean,
): t.ClassPrivateMethod {
return builder("ClassPrivateMethod", ...arguments);
}
export function importAttribute(
key: t.Identifier | t.StringLiteral,
value: t.StringLiteral,
Expand All @@ -1054,9 +1057,6 @@ export function exportDefaultSpecifier(
): t.ExportDefaultSpecifier {
return builder("ExportDefaultSpecifier", ...arguments);
}
export function privateName(id: t.Identifier): t.PrivateName {
return builder("PrivateName", ...arguments);
}
export function recordExpression(
properties: Array<t.ObjectProperty | t.SpreadElement>,
): t.RecordExpression {
Expand Down
8 changes: 4 additions & 4 deletions packages/babel-types/src/builders/generated/uppercase.js
Expand Up @@ -90,6 +90,10 @@ export {
exportNamespaceSpecifier as ExportNamespaceSpecifier,
optionalMemberExpression as OptionalMemberExpression,
optionalCallExpression as OptionalCallExpression,
classProperty as ClassProperty,
classPrivateProperty as ClassPrivateProperty,
classPrivateMethod as ClassPrivateMethod,
privateName as PrivateName,
anyTypeAnnotation as AnyTypeAnnotation,
arrayTypeAnnotation as ArrayTypeAnnotation,
booleanTypeAnnotation as BooleanTypeAnnotation,
Expand Down Expand Up @@ -175,17 +179,13 @@ export {
v8IntrinsicIdentifier as V8IntrinsicIdentifier,
argumentPlaceholder as ArgumentPlaceholder,
bindExpression as BindExpression,
classProperty as ClassProperty,
pipelineTopicExpression as PipelineTopicExpression,
pipelineBareFunction as PipelineBareFunction,
pipelinePrimaryTopicReference as PipelinePrimaryTopicReference,
classPrivateProperty as ClassPrivateProperty,
classPrivateMethod as ClassPrivateMethod,
importAttribute as ImportAttribute,
decorator as Decorator,
doExpression as DoExpression,
exportDefaultSpecifier as ExportDefaultSpecifier,
privateName as PrivateName,
recordExpression as RecordExpression,
tupleExpression as TupleExpression,
decimalLiteral as DecimalLiteral,
Expand Down

0 comments on commit 3840893

Please sign in to comment.