Skip to content

Commit 8c46e59

Browse files
authored
Fix missing fields for ClassAccessorProperty and related defs (#891)
1 parent f3eaff5 commit 8c46e59

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

src/def/babel-core.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ export default function (fork: Fork) {
250250
// Only when .computed is true (TODO enforce this)
251251
def("Expression"),
252252
))
253-
.field("value", def("Expression"));
253+
.field("value", or(def("Expression"), null), defaults["null"]);
254254

255255
["ClassMethod",
256256
"ClassPrivateMethod",
@@ -272,7 +272,9 @@ export default function (fork: Fork) {
272272
.field("abstract", Boolean, defaults["false"])
273273
.field("accessibility", or("public", "private", "protected", null), defaults["null"])
274274
.field("decorators", or([def("Decorator")], null), defaults["null"])
275+
.field("definite", Boolean, defaults["false"])
275276
.field("optional", Boolean, defaults["false"])
277+
.field("override", Boolean, defaults["false"])
276278
.field("readonly", Boolean, defaults["false"]);
277279
});
278280

src/gen/builders.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2770,13 +2770,15 @@ export interface ClassMethodBuilder {
27702770
computed?: boolean;
27712771
decorators?: K.DecoratorKind[] | null;
27722772
defaults?: (K.ExpressionKind | null)[];
2773+
definite?: boolean;
27732774
expression?: boolean;
27742775
generator?: boolean;
27752776
id?: K.IdentifierKind | null;
27762777
key: K.LiteralKind | K.IdentifierKind | K.ExpressionKind;
27772778
kind?: "get" | "set" | "method" | "constructor";
27782779
loc?: K.SourceLocationKind | null;
27792780
optional?: boolean;
2781+
override?: boolean;
27802782
params: K.PatternKind[];
27812783
predicate?: K.FlowPredicateKind | null;
27822784
readonly?: boolean;
@@ -2808,13 +2810,15 @@ export interface ClassPrivateMethodBuilder {
28082810
computed?: boolean;
28092811
decorators?: K.DecoratorKind[] | null;
28102812
defaults?: (K.ExpressionKind | null)[];
2813+
definite?: boolean;
28112814
expression?: boolean;
28122815
generator?: boolean;
28132816
id?: K.IdentifierKind | null;
28142817
key: K.PrivateNameKind;
28152818
kind?: "get" | "set" | "method" | "constructor";
28162819
loc?: K.SourceLocationKind | null;
28172820
optional?: boolean;
2821+
override?: boolean;
28182822
params: K.PatternKind[];
28192823
predicate?: K.FlowPredicateKind | null;
28202824
readonly?: boolean;
@@ -2829,7 +2833,7 @@ export interface ClassPrivateMethodBuilder {
28292833
export interface ClassAccessorPropertyBuilder {
28302834
(
28312835
key: K.LiteralKind | K.IdentifierKind | K.PrivateNameKind | K.ExpressionKind,
2832-
value: K.ExpressionKind,
2836+
value?: K.ExpressionKind | null,
28332837
decorators?: K.DecoratorKind[] | null,
28342838
computed?: boolean,
28352839
staticParam?: boolean
@@ -2841,13 +2845,15 @@ export interface ClassAccessorPropertyBuilder {
28412845
comments?: K.CommentKind[] | null;
28422846
computed?: boolean;
28432847
decorators?: K.DecoratorKind[] | null;
2848+
definite?: boolean;
28442849
key: K.LiteralKind | K.IdentifierKind | K.PrivateNameKind | K.ExpressionKind;
28452850
loc?: K.SourceLocationKind | null;
28462851
optional?: boolean;
2852+
override?: boolean;
28472853
readonly?: boolean;
28482854
static?: boolean;
28492855
typeAnnotation?: K.TSTypeAnnotationKind | null;
2850-
value: K.ExpressionKind;
2856+
value?: K.ExpressionKind | null;
28512857
}
28522858
): namedTypes.ClassAccessorProperty;
28532859
}

src/gen/namedTypes.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1287,7 +1287,9 @@ export namespace namedTypes {
12871287
abstract?: boolean;
12881288
accessibility?: "public" | "private" | "protected" | null;
12891289
decorators?: K.DecoratorKind[] | null;
1290+
definite?: boolean;
12901291
optional?: boolean;
1292+
override?: boolean;
12911293
readonly?: boolean;
12921294
}
12931295

@@ -1302,7 +1304,9 @@ export namespace namedTypes {
13021304
abstract?: boolean;
13031305
accessibility?: "public" | "private" | "protected" | null;
13041306
decorators?: K.DecoratorKind[] | null;
1307+
definite?: boolean;
13051308
optional?: boolean;
1309+
override?: boolean;
13061310
readonly?: boolean;
13071311
}
13081312

@@ -1313,13 +1317,15 @@ export namespace namedTypes {
13131317
export interface ClassAccessorProperty extends Omit<Declaration, "type">, TSHasOptionalTypeAnnotation {
13141318
type: "ClassAccessorProperty";
13151319
key: K.LiteralKind | K.IdentifierKind | K.PrivateNameKind | K.ExpressionKind;
1316-
value: K.ExpressionKind;
1320+
value?: K.ExpressionKind | null;
13171321
computed?: boolean;
13181322
static?: boolean;
13191323
abstract?: boolean;
13201324
accessibility?: "public" | "private" | "protected" | null;
13211325
decorators?: K.DecoratorKind[] | null;
1326+
definite?: boolean;
13221327
optional?: boolean;
1328+
override?: boolean;
13231329
readonly?: boolean;
13241330
}
13251331

0 commit comments

Comments
 (0)