@@ -64,6 +64,14 @@ export function isInternalAttributeName(item: unknown): item is InternalAttribut
64
64
return typeof item === 'string' ;
65
65
}
66
66
67
+ export type LiteralExpr = BooleanLiteral | NumberLiteral | StringLiteral ;
68
+
69
+ export const LiteralExpr = 'LiteralExpr' ;
70
+
71
+ export function isLiteralExpr ( item : unknown ) : item is LiteralExpr {
72
+ return reflection . isInstance ( item , LiteralExpr ) ;
73
+ }
74
+
67
75
export type QualifiedName = string ;
68
76
69
77
export function isQualifiedName ( item : unknown ) : item is QualifiedName {
@@ -187,6 +195,18 @@ export function isBinaryExpr(item: unknown): item is BinaryExpr {
187
195
return reflection . isInstance ( item , BinaryExpr ) ;
188
196
}
189
197
198
+ export interface BooleanLiteral extends AstNode {
199
+ readonly $container : Argument | ArrayExpr | AttributeArg | BinaryExpr | DataSourceField | FieldInitializer | FunctionDecl | GeneratorField | MemberAccessExpr | PluginField | UnaryExpr | UnsupportedFieldType ;
200
+ readonly $type : 'BooleanLiteral' ;
201
+ value : Boolean
202
+ }
203
+
204
+ export const BooleanLiteral = 'BooleanLiteral' ;
205
+
206
+ export function isBooleanLiteral ( item : unknown ) : item is BooleanLiteral {
207
+ return reflection . isInstance ( item , BooleanLiteral ) ;
208
+ }
209
+
190
210
export interface DataModel extends AstNode {
191
211
readonly $container : Model ;
192
212
readonly $type : 'DataModel' ;
@@ -426,18 +446,6 @@ export function isInvocationExpr(item: unknown): item is InvocationExpr {
426
446
return reflection . isInstance ( item , InvocationExpr ) ;
427
447
}
428
448
429
- export interface LiteralExpr extends AstNode {
430
- readonly $container : Argument | ArrayExpr | AttributeArg | BinaryExpr | DataSourceField | FieldInitializer | FunctionDecl | GeneratorField | MemberAccessExpr | PluginField | UnaryExpr | UnsupportedFieldType ;
431
- readonly $type : 'LiteralExpr' ;
432
- value : Boolean | number | string
433
- }
434
-
435
- export const LiteralExpr = 'LiteralExpr' ;
436
-
437
- export function isLiteralExpr ( item : unknown ) : item is LiteralExpr {
438
- return reflection . isInstance ( item , LiteralExpr ) ;
439
- }
440
-
441
449
export interface MemberAccessExpr extends AstNode {
442
450
readonly $container : Argument | ArrayExpr | AttributeArg | BinaryExpr | DataSourceField | FieldInitializer | FunctionDecl | GeneratorField | MemberAccessExpr | PluginField | UnaryExpr | UnsupportedFieldType ;
443
451
readonly $type : 'MemberAccessExpr' ;
@@ -487,6 +495,18 @@ export function isNullExpr(item: unknown): item is NullExpr {
487
495
return reflection . isInstance ( item , NullExpr ) ;
488
496
}
489
497
498
+ export interface NumberLiteral extends AstNode {
499
+ readonly $container : Argument | ArrayExpr | AttributeArg | BinaryExpr | DataSourceField | FieldInitializer | FunctionDecl | GeneratorField | MemberAccessExpr | PluginField | UnaryExpr | UnsupportedFieldType ;
500
+ readonly $type : 'NumberLiteral' ;
501
+ value : string
502
+ }
503
+
504
+ export const NumberLiteral = 'NumberLiteral' ;
505
+
506
+ export function isNumberLiteral ( item : unknown ) : item is NumberLiteral {
507
+ return reflection . isInstance ( item , NumberLiteral ) ;
508
+ }
509
+
490
510
export interface ObjectExpr extends AstNode {
491
511
readonly $container : Argument | ArrayExpr | AttributeArg | BinaryExpr | DataSourceField | FieldInitializer | FunctionDecl | GeneratorField | MemberAccessExpr | PluginField | UnaryExpr | UnsupportedFieldType ;
492
512
readonly $type : 'ObjectExpr' ;
@@ -551,6 +571,18 @@ export function isReferenceExpr(item: unknown): item is ReferenceExpr {
551
571
return reflection . isInstance ( item , ReferenceExpr ) ;
552
572
}
553
573
574
+ export interface StringLiteral extends AstNode {
575
+ readonly $container : Argument | ArrayExpr | AttributeArg | BinaryExpr | DataSourceField | FieldInitializer | FunctionDecl | GeneratorField | MemberAccessExpr | PluginField | UnaryExpr | UnsupportedFieldType ;
576
+ readonly $type : 'StringLiteral' ;
577
+ value : string
578
+ }
579
+
580
+ export const StringLiteral = 'StringLiteral' ;
581
+
582
+ export function isStringLiteral ( item : unknown ) : item is StringLiteral {
583
+ return reflection . isInstance ( item , StringLiteral ) ;
584
+ }
585
+
554
586
export interface ThisExpr extends AstNode {
555
587
readonly $container : Argument | ArrayExpr | AttributeArg | BinaryExpr | DataSourceField | FieldInitializer | FunctionDecl | GeneratorField | MemberAccessExpr | PluginField | UnaryExpr | UnsupportedFieldType ;
556
588
readonly $type : 'ThisExpr' ;
@@ -597,6 +629,7 @@ export type ZModelAstType = {
597
629
AttributeParam : AttributeParam
598
630
AttributeParamType : AttributeParamType
599
631
BinaryExpr : BinaryExpr
632
+ BooleanLiteral : BooleanLiteral
600
633
DataModel : DataModel
601
634
DataModelAttribute : DataModelAttribute
602
635
DataModelField : DataModelField
@@ -620,12 +653,14 @@ export type ZModelAstType = {
620
653
Model : Model
621
654
ModelImport : ModelImport
622
655
NullExpr : NullExpr
656
+ NumberLiteral : NumberLiteral
623
657
ObjectExpr : ObjectExpr
624
658
Plugin : Plugin
625
659
PluginField : PluginField
626
660
ReferenceArg : ReferenceArg
627
661
ReferenceExpr : ReferenceExpr
628
662
ReferenceTarget : ReferenceTarget
663
+ StringLiteral : StringLiteral
629
664
ThisExpr : ThisExpr
630
665
TypeDeclaration : TypeDeclaration
631
666
UnaryExpr : UnaryExpr
@@ -635,7 +670,7 @@ export type ZModelAstType = {
635
670
export class ZModelAstReflection extends AbstractAstReflection {
636
671
637
672
getAllTypes ( ) : string [ ] {
638
- return [ 'AbstractDeclaration' , 'Argument' , 'ArrayExpr' , 'Attribute' , 'AttributeArg' , 'AttributeParam' , 'AttributeParamType' , 'BinaryExpr' , 'DataModel' , 'DataModelAttribute' , 'DataModelField' , 'DataModelFieldAttribute' , 'DataModelFieldType' , 'DataSource' , 'DataSourceField' , 'Enum' , 'EnumField' , 'Expression' , 'FieldInitializer' , 'FunctionDecl' , 'FunctionParam' , 'FunctionParamType' , 'GeneratorDecl' , 'GeneratorField' , 'InternalAttribute' , 'InvocationExpr' , 'LiteralExpr' , 'MemberAccessExpr' , 'Model' , 'ModelImport' , 'NullExpr' , 'ObjectExpr' , 'Plugin' , 'PluginField' , 'ReferenceArg' , 'ReferenceExpr' , 'ReferenceTarget' , 'ThisExpr' , 'TypeDeclaration' , 'UnaryExpr' , 'UnsupportedFieldType' ] ;
673
+ return [ 'AbstractDeclaration' , 'Argument' , 'ArrayExpr' , 'Attribute' , 'AttributeArg' , 'AttributeParam' , 'AttributeParamType' , 'BinaryExpr' , 'BooleanLiteral' , ' DataModel', 'DataModelAttribute' , 'DataModelField' , 'DataModelFieldAttribute' , 'DataModelFieldType' , 'DataSource' , 'DataSourceField' , 'Enum' , 'EnumField' , 'Expression' , 'FieldInitializer' , 'FunctionDecl' , 'FunctionParam' , 'FunctionParamType' , 'GeneratorDecl' , 'GeneratorField' , 'InternalAttribute' , 'InvocationExpr' , 'LiteralExpr' , 'MemberAccessExpr' , 'Model' , 'ModelImport' , 'NullExpr' , 'NumberLiteral' , ' ObjectExpr', 'Plugin' , 'PluginField' , 'ReferenceArg' , 'ReferenceExpr' , 'ReferenceTarget' , 'StringLiteral ', 'ThisExpr' , 'TypeDeclaration' , 'UnaryExpr' , 'UnsupportedFieldType' ] ;
639
674
}
640
675
641
676
protected override computeIsSubtype ( subtype : string , supertype : string ) : boolean {
@@ -659,6 +694,11 @@ export class ZModelAstReflection extends AbstractAstReflection {
659
694
case Plugin : {
660
695
return this . isSubtype ( AbstractDeclaration , supertype ) ;
661
696
}
697
+ case BooleanLiteral :
698
+ case NumberLiteral :
699
+ case StringLiteral : {
700
+ return this . isSubtype ( LiteralExpr , supertype ) ;
701
+ }
662
702
case DataModel :
663
703
case Enum : {
664
704
return this . isSubtype ( AbstractDeclaration , supertype ) || this . isSubtype ( TypeDeclaration , supertype ) ;
0 commit comments