diff --git a/src/def/es-proposals.ts b/src/def/es-proposals.ts index 1b577706..ab2aa3f5 100644 --- a/src/def/es-proposals.ts +++ b/src/def/es-proposals.ts @@ -20,20 +20,23 @@ export default function (fork: Fork) { .field("all", Boolean, defaults["false"]); // Decorators + // https://github.com/tc39/proposal-decorators def("Decorator") .bases("Node") .build("expression") .field("expression", def("Expression")); - def("Property") - .field("decorators", - or([def("Decorator")], null), - defaults["null"]); - - def("MethodDefinition") - .field("decorators", - or([def("Decorator")], null), - defaults["null"]); + [ + "ClassDeclaration", + "Property", + "ClassProperty", + "MethodDefinition" + ].forEach(decl => { + def(decl) + .field("decorators", + or([def("Decorator")], null), + defaults["null"]); + }); // Private names def("PrivateName") diff --git a/src/gen/builders.ts b/src/gen/builders.ts index 5b88423a..b50f4f9a 100644 --- a/src/gen/builders.ts +++ b/src/gen/builders.ts @@ -879,6 +879,7 @@ export interface ClassPropertyBuilder { access?: "public" | "private" | "protected" | undefined; comments?: K.CommentKind[] | null; computed?: boolean; + decorators?: K.DecoratorKind[] | null; key: K.LiteralKind | K.IdentifierKind | K.ExpressionKind; loc?: K.SourceLocationKind | null; static?: boolean; @@ -923,6 +924,7 @@ export interface ClassDeclarationBuilder { params: { body: K.ClassBodyKind; comments?: K.CommentKind[] | null; + decorators?: K.DecoratorKind[] | null; id: K.IdentifierKind | null; implements?: K.ClassImplementsKind[] | K.TSExpressionWithTypeArgumentsKind[]; loc?: K.SourceLocationKind | null; @@ -1271,6 +1273,7 @@ export interface ClassPrivatePropertyBuilder { access?: "public" | "private" | "protected" | undefined; comments?: K.CommentKind[] | null; computed?: boolean; + decorators?: K.DecoratorKind[] | null; key: K.PrivateNameKind; loc?: K.SourceLocationKind | null; static?: boolean; @@ -2126,6 +2129,7 @@ export interface PropertyDefinitionBuilder { access?: "public" | "private" | "protected" | undefined; comments?: K.CommentKind[] | null; computed?: boolean; + decorators?: K.DecoratorKind[] | null; key: K.LiteralKind | K.IdentifierKind | K.ExpressionKind; loc?: K.SourceLocationKind | null; static?: boolean; diff --git a/src/gen/namedTypes.ts b/src/gen/namedTypes.ts index 7f6ecb2e..984eaf54 100644 --- a/src/gen/namedTypes.ts +++ b/src/gen/namedTypes.ts @@ -432,6 +432,7 @@ export namespace namedTypes { type: "ClassProperty"; key: K.LiteralKind | K.IdentifierKind | K.ExpressionKind; computed?: boolean; + decorators?: K.DecoratorKind[] | null; value: K.ExpressionKind | null; static?: boolean; typeAnnotation?: K.TypeAnnotationKind | K.TSTypeAnnotationKind | null; @@ -454,6 +455,7 @@ export namespace namedTypes { id: K.IdentifierKind | null; body: K.ClassBodyKind; superClass?: K.ExpressionKind | null; + decorators?: K.DecoratorKind[] | null; typeParameters?: K.TypeParameterDeclarationKind | K.TSTypeParameterDeclarationKind | null; superTypeParameters?: K.TypeParameterInstantiationKind | K.TSTypeParameterInstantiationKind | null; implements?: K.ClassImplementsKind[] | K.TSExpressionWithTypeArgumentsKind[];