@@ -14,12 +14,6 @@ export function isAbstractDeclaration(item: unknown): item is AbstractDeclaratio
14
14
return reflection . isInstance ( item , AbstractDeclaration ) ;
15
15
}
16
16
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
-
23
17
export type Boolean = boolean ;
24
18
25
19
export function isBoolean ( item : unknown ) : item is Boolean {
@@ -40,18 +34,6 @@ export function isConfigExpr(item: unknown): item is ConfigExpr {
40
34
return reflection . isInstance ( item , ConfigExpr ) ;
41
35
}
42
36
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
-
55
37
export type Expression = ArrayExpr | BinaryExpr | InvocationExpr | LiteralExpr | MemberAccessExpr | NullExpr | ObjectExpr | ReferenceExpr | ThisExpr | UnaryExpr ;
56
38
57
39
export const Expression = 'Expression' ;
@@ -66,12 +48,6 @@ export function isExpressionType(item: unknown): item is ExpressionType {
66
48
return item === 'String' || item === 'Int' || item === 'Float' || item === 'Boolean' || item === 'DateTime' || item === 'Null' || item === 'Object' || item === 'Any' || item === 'Unsupported' ;
67
49
}
68
50
69
- export type InternalAttributeName = string ;
70
-
71
- export function isInternalAttributeName ( item : unknown ) : item is InternalAttributeName {
72
- return typeof item === 'string' ;
73
- }
74
-
75
51
export type LiteralExpr = BooleanLiteral | NumberLiteral | StringLiteral ;
76
52
77
53
export const LiteralExpr = 'LiteralExpr' ;
@@ -80,12 +56,6 @@ export function isLiteralExpr(item: unknown): item is LiteralExpr {
80
56
return reflection . isInstance ( item , LiteralExpr ) ;
81
57
}
82
58
83
- export type QualifiedName = string ;
84
-
85
- export function isQualifiedName ( item : unknown ) : item is QualifiedName {
86
- return typeof item === 'string' ;
87
- }
88
-
89
59
export type ReferenceTarget = DataModelField | EnumField | FunctionParam ;
90
60
91
61
export const ReferenceTarget = 'ReferenceTarget' ;
@@ -137,7 +107,8 @@ export interface Attribute extends AstNode {
137
107
readonly $container : Model ;
138
108
readonly $type : 'Attribute' ;
139
109
attributes : Array < InternalAttribute >
140
- name : AttributeName
110
+ comments : Array < string >
111
+ name : string
141
112
params : Array < AttributeParam >
142
113
}
143
114
@@ -163,6 +134,8 @@ export function isAttributeArg(item: unknown): item is AttributeArg {
163
134
export interface AttributeParam extends AstNode {
164
135
readonly $container : Attribute ;
165
136
readonly $type : 'AttributeParam' ;
137
+ attributes : Array < InternalAttribute >
138
+ comments : Array < string >
166
139
default : boolean
167
140
name : RegularID
168
141
type : AttributeParamType
@@ -454,7 +427,7 @@ export function isGeneratorDecl(item: unknown): item is GeneratorDecl {
454
427
}
455
428
456
429
export interface InternalAttribute extends AstNode {
457
- readonly $container : Attribute | FunctionDecl ;
430
+ readonly $container : Attribute | AttributeParam | FunctionDecl ;
458
431
readonly $type : 'InternalAttribute' ;
459
432
args : Array < AttributeArg >
460
433
decl : Reference < Attribute >
@@ -519,7 +492,7 @@ export function isModelImport(item: unknown): item is ModelImport {
519
492
export interface NullExpr extends AstNode {
520
493
readonly $container : Argument | ArrayExpr | AttributeArg | BinaryExpr | ConfigArrayExpr | ConfigField | ConfigInvocationArg | FieldInitializer | FunctionDecl | MemberAccessExpr | PluginField | UnaryExpr | UnsupportedFieldType ;
521
494
readonly $type : 'NullExpr' ;
522
- value : string
495
+ value : 'null'
523
496
}
524
497
525
498
export const NullExpr = 'NullExpr' ;
@@ -619,7 +592,7 @@ export function isStringLiteral(item: unknown): item is StringLiteral {
619
592
export interface ThisExpr extends AstNode {
620
593
readonly $container : Argument | ArrayExpr | AttributeArg | BinaryExpr | ConfigArrayExpr | ConfigField | ConfigInvocationArg | FieldInitializer | FunctionDecl | MemberAccessExpr | PluginField | UnaryExpr | UnsupportedFieldType ;
621
594
readonly $type : 'ThisExpr' ;
622
- value : string
595
+ value : 'this'
623
596
}
624
597
625
598
export const ThisExpr = 'ThisExpr' ;
@@ -801,6 +774,7 @@ export class ZModelAstReflection extends AbstractAstReflection {
801
774
name : 'Attribute' ,
802
775
mandatory : [
803
776
{ name : 'attributes' , type : 'array' } ,
777
+ { name : 'comments' , type : 'array' } ,
804
778
{ name : 'params' , type : 'array' }
805
779
]
806
780
} ;
@@ -809,6 +783,8 @@ export class ZModelAstReflection extends AbstractAstReflection {
809
783
return {
810
784
name : 'AttributeParam' ,
811
785
mandatory : [
786
+ { name : 'attributes' , type : 'array' } ,
787
+ { name : 'comments' , type : 'array' } ,
812
788
{ name : 'default' , type : 'boolean' }
813
789
]
814
790
} ;
0 commit comments