@@ -14,12 +14,6 @@ export function isAbstractDeclaration(item: unknown): item is AbstractDeclaratio
1414 return reflection . isInstance ( item , AbstractDeclaration ) ;
1515}
1616
17- export type AttributeName = DataModelAttributeName | DataModelFieldAttributeName | InternalAttributeName ;
18-
19- export function isAttributeName ( item : unknown ) : item is AttributeName {
20- return isDataModelAttributeName ( item ) || isDataModelFieldAttributeName ( item ) || isInternalAttributeName ( item ) ;
21- }
22-
2317export type Boolean = boolean ;
2418
2519export function isBoolean ( item : unknown ) : item is Boolean {
@@ -40,18 +34,6 @@ export function isConfigExpr(item: unknown): item is ConfigExpr {
4034 return reflection . isInstance ( item , ConfigExpr ) ;
4135}
4236
43- export type DataModelAttributeName = string ;
44-
45- export function isDataModelAttributeName ( item : unknown ) : item is DataModelAttributeName {
46- return typeof item === 'string' ;
47- }
48-
49- export type DataModelFieldAttributeName = string ;
50-
51- export function isDataModelFieldAttributeName ( item : unknown ) : item is DataModelFieldAttributeName {
52- return typeof item === 'string' ;
53- }
54-
5537export type Expression = ArrayExpr | BinaryExpr | InvocationExpr | LiteralExpr | MemberAccessExpr | NullExpr | ObjectExpr | ReferenceExpr | ThisExpr | UnaryExpr ;
5638
5739export const Expression = 'Expression' ;
@@ -66,12 +48,6 @@ export function isExpressionType(item: unknown): item is ExpressionType {
6648 return item === 'String' || item === 'Int' || item === 'Float' || item === 'Boolean' || item === 'DateTime' || item === 'Null' || item === 'Object' || item === 'Any' || item === 'Unsupported' ;
6749}
6850
69- export type InternalAttributeName = string ;
70-
71- export function isInternalAttributeName ( item : unknown ) : item is InternalAttributeName {
72- return typeof item === 'string' ;
73- }
74-
7551export type LiteralExpr = BooleanLiteral | NumberLiteral | StringLiteral ;
7652
7753export const LiteralExpr = 'LiteralExpr' ;
@@ -80,12 +56,6 @@ export function isLiteralExpr(item: unknown): item is LiteralExpr {
8056 return reflection . isInstance ( item , LiteralExpr ) ;
8157}
8258
83- export type QualifiedName = string ;
84-
85- export function isQualifiedName ( item : unknown ) : item is QualifiedName {
86- return typeof item === 'string' ;
87- }
88-
8959export type ReferenceTarget = DataModelField | EnumField | FunctionParam ;
9060
9161export const ReferenceTarget = 'ReferenceTarget' ;
@@ -137,7 +107,8 @@ export interface Attribute extends AstNode {
137107 readonly $container : Model ;
138108 readonly $type : 'Attribute' ;
139109 attributes : Array < InternalAttribute >
140- name : AttributeName
110+ comments : Array < string >
111+ name : string
141112 params : Array < AttributeParam >
142113}
143114
@@ -163,6 +134,8 @@ export function isAttributeArg(item: unknown): item is AttributeArg {
163134export interface AttributeParam extends AstNode {
164135 readonly $container : Attribute ;
165136 readonly $type : 'AttributeParam' ;
137+ attributes : Array < InternalAttribute >
138+ comments : Array < string >
166139 default : boolean
167140 name : RegularID
168141 type : AttributeParamType
@@ -454,7 +427,7 @@ export function isGeneratorDecl(item: unknown): item is GeneratorDecl {
454427}
455428
456429export interface InternalAttribute extends AstNode {
457- readonly $container : Attribute | FunctionDecl ;
430+ readonly $container : Attribute | AttributeParam | FunctionDecl ;
458431 readonly $type : 'InternalAttribute' ;
459432 args : Array < AttributeArg >
460433 decl : Reference < Attribute >
@@ -519,7 +492,7 @@ export function isModelImport(item: unknown): item is ModelImport {
519492export interface NullExpr extends AstNode {
520493 readonly $container : Argument | ArrayExpr | AttributeArg | BinaryExpr | ConfigArrayExpr | ConfigField | ConfigInvocationArg | FieldInitializer | FunctionDecl | MemberAccessExpr | PluginField | UnaryExpr | UnsupportedFieldType ;
521494 readonly $type : 'NullExpr' ;
522- value : string
495+ value : 'null'
523496}
524497
525498export const NullExpr = 'NullExpr' ;
@@ -619,7 +592,7 @@ export function isStringLiteral(item: unknown): item is StringLiteral {
619592export interface ThisExpr extends AstNode {
620593 readonly $container : Argument | ArrayExpr | AttributeArg | BinaryExpr | ConfigArrayExpr | ConfigField | ConfigInvocationArg | FieldInitializer | FunctionDecl | MemberAccessExpr | PluginField | UnaryExpr | UnsupportedFieldType ;
621594 readonly $type : 'ThisExpr' ;
622- value : string
595+ value : 'this'
623596}
624597
625598export const ThisExpr = 'ThisExpr' ;
@@ -801,6 +774,7 @@ export class ZModelAstReflection extends AbstractAstReflection {
801774 name : 'Attribute' ,
802775 mandatory : [
803776 { name : 'attributes' , type : 'array' } ,
777+ { name : 'comments' , type : 'array' } ,
804778 { name : 'params' , type : 'array' }
805779 ]
806780 } ;
@@ -809,6 +783,8 @@ export class ZModelAstReflection extends AbstractAstReflection {
809783 return {
810784 name : 'AttributeParam' ,
811785 mandatory : [
786+ { name : 'attributes' , type : 'array' } ,
787+ { name : 'comments' , type : 'array' } ,
812788 { name : 'default' , type : 'boolean' }
813789 ]
814790 } ;
0 commit comments