@@ -64,6 +64,14 @@ export function isInternalAttributeName(item: unknown): item is InternalAttribut
6464 return typeof item === 'string' ;
6565}
6666
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+
6775export type QualifiedName = string ;
6876
6977export function isQualifiedName ( item : unknown ) : item is QualifiedName {
@@ -187,6 +195,18 @@ export function isBinaryExpr(item: unknown): item is BinaryExpr {
187195 return reflection . isInstance ( item , BinaryExpr ) ;
188196}
189197
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+
190210export interface DataModel extends AstNode {
191211 readonly $container : Model ;
192212 readonly $type : 'DataModel' ;
@@ -426,18 +446,6 @@ export function isInvocationExpr(item: unknown): item is InvocationExpr {
426446 return reflection . isInstance ( item , InvocationExpr ) ;
427447}
428448
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-
441449export interface MemberAccessExpr extends AstNode {
442450 readonly $container : Argument | ArrayExpr | AttributeArg | BinaryExpr | DataSourceField | FieldInitializer | FunctionDecl | GeneratorField | MemberAccessExpr | PluginField | UnaryExpr | UnsupportedFieldType ;
443451 readonly $type : 'MemberAccessExpr' ;
@@ -487,6 +495,18 @@ export function isNullExpr(item: unknown): item is NullExpr {
487495 return reflection . isInstance ( item , NullExpr ) ;
488496}
489497
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+
490510export interface ObjectExpr extends AstNode {
491511 readonly $container : Argument | ArrayExpr | AttributeArg | BinaryExpr | DataSourceField | FieldInitializer | FunctionDecl | GeneratorField | MemberAccessExpr | PluginField | UnaryExpr | UnsupportedFieldType ;
492512 readonly $type : 'ObjectExpr' ;
@@ -551,6 +571,18 @@ export function isReferenceExpr(item: unknown): item is ReferenceExpr {
551571 return reflection . isInstance ( item , ReferenceExpr ) ;
552572}
553573
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+
554586export interface ThisExpr extends AstNode {
555587 readonly $container : Argument | ArrayExpr | AttributeArg | BinaryExpr | DataSourceField | FieldInitializer | FunctionDecl | GeneratorField | MemberAccessExpr | PluginField | UnaryExpr | UnsupportedFieldType ;
556588 readonly $type : 'ThisExpr' ;
@@ -597,6 +629,7 @@ export type ZModelAstType = {
597629 AttributeParam : AttributeParam
598630 AttributeParamType : AttributeParamType
599631 BinaryExpr : BinaryExpr
632+ BooleanLiteral : BooleanLiteral
600633 DataModel : DataModel
601634 DataModelAttribute : DataModelAttribute
602635 DataModelField : DataModelField
@@ -620,12 +653,14 @@ export type ZModelAstType = {
620653 Model : Model
621654 ModelImport : ModelImport
622655 NullExpr : NullExpr
656+ NumberLiteral : NumberLiteral
623657 ObjectExpr : ObjectExpr
624658 Plugin : Plugin
625659 PluginField : PluginField
626660 ReferenceArg : ReferenceArg
627661 ReferenceExpr : ReferenceExpr
628662 ReferenceTarget : ReferenceTarget
663+ StringLiteral : StringLiteral
629664 ThisExpr : ThisExpr
630665 TypeDeclaration : TypeDeclaration
631666 UnaryExpr : UnaryExpr
@@ -635,7 +670,7 @@ export type ZModelAstType = {
635670export class ZModelAstReflection extends AbstractAstReflection {
636671
637672 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' ] ;
639674 }
640675
641676 protected override computeIsSubtype ( subtype : string , supertype : string ) : boolean {
@@ -659,6 +694,11 @@ export class ZModelAstReflection extends AbstractAstReflection {
659694 case Plugin : {
660695 return this . isSubtype ( AbstractDeclaration , supertype ) ;
661696 }
697+ case BooleanLiteral :
698+ case NumberLiteral :
699+ case StringLiteral : {
700+ return this . isSubtype ( LiteralExpr , supertype ) ;
701+ }
662702 case DataModel :
663703 case Enum : {
664704 return this . isSubtype ( AbstractDeclaration , supertype ) || this . isSubtype ( TypeDeclaration , supertype ) ;
0 commit comments