Skip to content

Commit

Permalink
Fix missing fields for ClassAccessorProperty and related defs (#891)
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamn authored Dec 13, 2022
1 parent f3eaff5 commit 8c46e59
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/def/babel-core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ export default function (fork: Fork) {
// Only when .computed is true (TODO enforce this)
def("Expression"),
))
.field("value", def("Expression"));
.field("value", or(def("Expression"), null), defaults["null"]);

["ClassMethod",
"ClassPrivateMethod",
Expand All @@ -272,7 +272,9 @@ export default function (fork: Fork) {
.field("abstract", Boolean, defaults["false"])
.field("accessibility", or("public", "private", "protected", null), defaults["null"])
.field("decorators", or([def("Decorator")], null), defaults["null"])
.field("definite", Boolean, defaults["false"])
.field("optional", Boolean, defaults["false"])
.field("override", Boolean, defaults["false"])
.field("readonly", Boolean, defaults["false"]);
});

Expand Down
10 changes: 8 additions & 2 deletions src/gen/builders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2770,13 +2770,15 @@ export interface ClassMethodBuilder {
computed?: boolean;
decorators?: K.DecoratorKind[] | null;
defaults?: (K.ExpressionKind | null)[];
definite?: boolean;
expression?: boolean;
generator?: boolean;
id?: K.IdentifierKind | null;
key: K.LiteralKind | K.IdentifierKind | K.ExpressionKind;
kind?: "get" | "set" | "method" | "constructor";
loc?: K.SourceLocationKind | null;
optional?: boolean;
override?: boolean;
params: K.PatternKind[];
predicate?: K.FlowPredicateKind | null;
readonly?: boolean;
Expand Down Expand Up @@ -2808,13 +2810,15 @@ export interface ClassPrivateMethodBuilder {
computed?: boolean;
decorators?: K.DecoratorKind[] | null;
defaults?: (K.ExpressionKind | null)[];
definite?: boolean;
expression?: boolean;
generator?: boolean;
id?: K.IdentifierKind | null;
key: K.PrivateNameKind;
kind?: "get" | "set" | "method" | "constructor";
loc?: K.SourceLocationKind | null;
optional?: boolean;
override?: boolean;
params: K.PatternKind[];
predicate?: K.FlowPredicateKind | null;
readonly?: boolean;
Expand All @@ -2829,7 +2833,7 @@ export interface ClassPrivateMethodBuilder {
export interface ClassAccessorPropertyBuilder {
(
key: K.LiteralKind | K.IdentifierKind | K.PrivateNameKind | K.ExpressionKind,
value: K.ExpressionKind,
value?: K.ExpressionKind | null,
decorators?: K.DecoratorKind[] | null,
computed?: boolean,
staticParam?: boolean
Expand All @@ -2841,13 +2845,15 @@ export interface ClassAccessorPropertyBuilder {
comments?: K.CommentKind[] | null;
computed?: boolean;
decorators?: K.DecoratorKind[] | null;
definite?: boolean;
key: K.LiteralKind | K.IdentifierKind | K.PrivateNameKind | K.ExpressionKind;
loc?: K.SourceLocationKind | null;
optional?: boolean;
override?: boolean;
readonly?: boolean;
static?: boolean;
typeAnnotation?: K.TSTypeAnnotationKind | null;
value: K.ExpressionKind;
value?: K.ExpressionKind | null;
}
): namedTypes.ClassAccessorProperty;
}
Expand Down
8 changes: 7 additions & 1 deletion src/gen/namedTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1287,7 +1287,9 @@ export namespace namedTypes {
abstract?: boolean;
accessibility?: "public" | "private" | "protected" | null;
decorators?: K.DecoratorKind[] | null;
definite?: boolean;
optional?: boolean;
override?: boolean;
readonly?: boolean;
}

Expand All @@ -1302,7 +1304,9 @@ export namespace namedTypes {
abstract?: boolean;
accessibility?: "public" | "private" | "protected" | null;
decorators?: K.DecoratorKind[] | null;
definite?: boolean;
optional?: boolean;
override?: boolean;
readonly?: boolean;
}

Expand All @@ -1313,13 +1317,15 @@ export namespace namedTypes {
export interface ClassAccessorProperty extends Omit<Declaration, "type">, TSHasOptionalTypeAnnotation {
type: "ClassAccessorProperty";
key: K.LiteralKind | K.IdentifierKind | K.PrivateNameKind | K.ExpressionKind;
value: K.ExpressionKind;
value?: K.ExpressionKind | null;
computed?: boolean;
static?: boolean;
abstract?: boolean;
accessibility?: "public" | "private" | "protected" | null;
decorators?: K.DecoratorKind[] | null;
definite?: boolean;
optional?: boolean;
override?: boolean;
readonly?: boolean;
}

Expand Down

0 comments on commit 8c46e59

Please sign in to comment.