@zenstackhq/language
Advanced tools
Comparing version 2.8.1 to 2.9.0
@@ -37,3 +37,6 @@ /****************************************************************************** | ||
export declare function isLiteralExpr(item: unknown): item is LiteralExpr; | ||
export type ReferenceTarget = DataModelField | EnumField | FunctionParam; | ||
export type MemberAccessTarget = DataModelField | TypeDefField; | ||
export declare const MemberAccessTarget = "MemberAccessTarget"; | ||
export declare function isMemberAccessTarget(item: unknown): item is MemberAccessTarget; | ||
export type ReferenceTarget = DataModelField | EnumField | FunctionParam | TypeDefField; | ||
export declare const ReferenceTarget = "ReferenceTarget"; | ||
@@ -165,3 +168,3 @@ export declare function isReferenceTarget(item: unknown): item is ReferenceTarget; | ||
export interface DataModelAttribute extends AstNode { | ||
readonly $container: DataModel | Enum; | ||
readonly $container: DataModel | Enum | TypeDef; | ||
readonly $type: 'DataModelAttribute'; | ||
@@ -174,3 +177,3 @@ args: Array<AttributeArg>; | ||
export interface DataModelField extends AstNode { | ||
readonly $container: DataModel | Enum | FunctionDecl; | ||
readonly $container: DataModel | Enum | FunctionDecl | TypeDef; | ||
readonly $type: 'DataModelField'; | ||
@@ -222,3 +225,3 @@ attributes: Array<DataModelFieldAttribute>; | ||
export interface EnumField extends AstNode { | ||
readonly $container: DataModel | Enum | FunctionDecl; | ||
readonly $container: DataModel | Enum | FunctionDecl | TypeDef; | ||
readonly $type: 'EnumField'; | ||
@@ -251,3 +254,3 @@ attributes: Array<DataModelFieldAttribute>; | ||
export interface FunctionParam extends AstNode { | ||
readonly $container: DataModel | Enum | FunctionDecl; | ||
readonly $container: DataModel | Enum | FunctionDecl | TypeDef; | ||
readonly $type: 'FunctionParam'; | ||
@@ -296,3 +299,3 @@ name: RegularID; | ||
readonly $type: 'MemberAccessExpr'; | ||
member: Reference<DataModelField>; | ||
member: Reference<MemberAccessTarget>; | ||
operand: Expression; | ||
@@ -386,2 +389,3 @@ } | ||
readonly $type: 'TypeDef'; | ||
attributes: Array<DataModelAttribute>; | ||
comments: Array<string>; | ||
@@ -394,3 +398,3 @@ fields: Array<TypeDefField>; | ||
export interface TypeDefField extends AstNode { | ||
readonly $container: TypeDef; | ||
readonly $container: DataModel | Enum | FunctionDecl | TypeDef; | ||
readonly $type: 'TypeDefField'; | ||
@@ -462,2 +466,3 @@ attributes: Array<DataModelFieldAttribute>; | ||
MemberAccessExpr: MemberAccessExpr; | ||
MemberAccessTarget: MemberAccessTarget; | ||
Model: Model; | ||
@@ -464,0 +469,0 @@ ModelImport: ModelImport; |
@@ -7,4 +7,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.TypeDefFieldType = exports.TypeDefField = exports.TypeDef = exports.ThisExpr = exports.StringLiteral = exports.ReferenceExpr = exports.ReferenceArg = exports.PluginField = exports.Plugin = exports.ObjectExpr = exports.NumberLiteral = exports.NullExpr = exports.ModelImport = exports.Model = exports.MemberAccessExpr = exports.InvocationExpr = exports.InternalAttribute = exports.GeneratorDecl = exports.FunctionParamType = exports.FunctionParam = exports.FunctionDecl = exports.FieldInitializer = exports.EnumField = exports.Enum = exports.DataSource = exports.DataModelFieldType = exports.DataModelFieldAttribute = exports.DataModelField = exports.DataModelAttribute = exports.DataModel = exports.ConfigInvocationExpr = exports.ConfigInvocationArg = exports.ConfigField = exports.ConfigArrayExpr = exports.BooleanLiteral = exports.BinaryExpr = exports.AttributeParamType = exports.AttributeParam = exports.AttributeArg = exports.Attribute = exports.ArrayExpr = exports.Argument = exports.TypeDefFieldTypes = exports.TypeDeclaration = exports.ReferenceTarget = exports.LiteralExpr = exports.Expression = exports.ConfigExpr = exports.AbstractDeclaration = exports.ZModelTerminals = void 0; | ||
exports.reflection = exports.ZModelAstReflection = exports.UnsupportedFieldType = exports.UnaryExpr = void 0; | ||
exports.TypeDefField = exports.TypeDef = exports.ThisExpr = exports.StringLiteral = exports.ReferenceExpr = exports.ReferenceArg = exports.PluginField = exports.Plugin = exports.ObjectExpr = exports.NumberLiteral = exports.NullExpr = exports.ModelImport = exports.Model = exports.MemberAccessExpr = exports.InvocationExpr = exports.InternalAttribute = exports.GeneratorDecl = exports.FunctionParamType = exports.FunctionParam = exports.FunctionDecl = exports.FieldInitializer = exports.EnumField = exports.Enum = exports.DataSource = exports.DataModelFieldType = exports.DataModelFieldAttribute = exports.DataModelField = exports.DataModelAttribute = exports.DataModel = exports.ConfigInvocationExpr = exports.ConfigInvocationArg = exports.ConfigField = exports.ConfigArrayExpr = exports.BooleanLiteral = exports.BinaryExpr = exports.AttributeParamType = exports.AttributeParam = exports.AttributeArg = exports.Attribute = exports.ArrayExpr = exports.Argument = exports.TypeDefFieldTypes = exports.TypeDeclaration = exports.ReferenceTarget = exports.MemberAccessTarget = exports.LiteralExpr = exports.Expression = exports.ConfigExpr = exports.AbstractDeclaration = exports.ZModelTerminals = void 0; | ||
exports.reflection = exports.ZModelAstReflection = exports.UnsupportedFieldType = exports.UnaryExpr = exports.TypeDefFieldType = void 0; | ||
exports.isAbstractDeclaration = isAbstractDeclaration; | ||
@@ -17,2 +17,3 @@ exports.isBoolean = isBoolean; | ||
exports.isLiteralExpr = isLiteralExpr; | ||
exports.isMemberAccessTarget = isMemberAccessTarget; | ||
exports.isReferenceTarget = isReferenceTarget; | ||
@@ -105,2 +106,6 @@ exports.isRegularID = isRegularID; | ||
} | ||
exports.MemberAccessTarget = 'MemberAccessTarget'; | ||
function isMemberAccessTarget(item) { | ||
return exports.reflection.isInstance(item, exports.MemberAccessTarget); | ||
} | ||
exports.ReferenceTarget = 'ReferenceTarget'; | ||
@@ -302,3 +307,3 @@ function isReferenceTarget(item) { | ||
getAllTypes() { | ||
return ['AbstractDeclaration', 'Argument', 'ArrayExpr', 'Attribute', 'AttributeArg', 'AttributeParam', 'AttributeParamType', 'BinaryExpr', 'BooleanLiteral', 'ConfigArrayExpr', 'ConfigExpr', 'ConfigField', 'ConfigInvocationArg', 'ConfigInvocationExpr', 'DataModel', 'DataModelAttribute', 'DataModelField', 'DataModelFieldAttribute', 'DataModelFieldType', 'DataSource', 'Enum', 'EnumField', 'Expression', 'FieldInitializer', 'FunctionDecl', 'FunctionParam', 'FunctionParamType', 'GeneratorDecl', 'InternalAttribute', 'InvocationExpr', 'LiteralExpr', 'MemberAccessExpr', 'Model', 'ModelImport', 'NullExpr', 'NumberLiteral', 'ObjectExpr', 'Plugin', 'PluginField', 'ReferenceArg', 'ReferenceExpr', 'ReferenceTarget', 'StringLiteral', 'ThisExpr', 'TypeDeclaration', 'TypeDef', 'TypeDefField', 'TypeDefFieldType', 'TypeDefFieldTypes', 'UnaryExpr', 'UnsupportedFieldType']; | ||
return ['AbstractDeclaration', 'Argument', 'ArrayExpr', 'Attribute', 'AttributeArg', 'AttributeParam', 'AttributeParamType', 'BinaryExpr', 'BooleanLiteral', 'ConfigArrayExpr', 'ConfigExpr', 'ConfigField', 'ConfigInvocationArg', 'ConfigInvocationExpr', 'DataModel', 'DataModelAttribute', 'DataModelField', 'DataModelFieldAttribute', 'DataModelFieldType', 'DataSource', 'Enum', 'EnumField', 'Expression', 'FieldInitializer', 'FunctionDecl', 'FunctionParam', 'FunctionParamType', 'GeneratorDecl', 'InternalAttribute', 'InvocationExpr', 'LiteralExpr', 'MemberAccessExpr', 'MemberAccessTarget', 'Model', 'ModelImport', 'NullExpr', 'NumberLiteral', 'ObjectExpr', 'Plugin', 'PluginField', 'ReferenceArg', 'ReferenceExpr', 'ReferenceTarget', 'StringLiteral', 'ThisExpr', 'TypeDeclaration', 'TypeDef', 'TypeDefField', 'TypeDefFieldType', 'TypeDefFieldTypes', 'UnaryExpr', 'UnsupportedFieldType']; | ||
} | ||
@@ -336,5 +341,4 @@ computeIsSubtype(subtype, supertype) { | ||
case exports.DataModelField: | ||
case exports.EnumField: | ||
case exports.FunctionParam: { | ||
return this.isSubtype(exports.ReferenceTarget, supertype); | ||
case exports.TypeDefField: { | ||
return this.isSubtype(exports.MemberAccessTarget, supertype) || this.isSubtype(exports.ReferenceTarget, supertype); | ||
} | ||
@@ -345,2 +349,6 @@ case exports.Enum: | ||
} | ||
case exports.EnumField: | ||
case exports.FunctionParam: { | ||
return this.isSubtype(exports.ReferenceTarget, supertype); | ||
} | ||
case exports.InvocationExpr: | ||
@@ -375,3 +383,3 @@ case exports.LiteralExpr: { | ||
case 'MemberAccessExpr:member': { | ||
return exports.DataModelField; | ||
return exports.MemberAccessTarget; | ||
} | ||
@@ -604,2 +612,3 @@ case 'ReferenceExpr:target': { | ||
mandatory: [ | ||
{ name: 'attributes', type: 'array' }, | ||
{ name: 'comments', type: 'array' }, | ||
@@ -606,0 +615,0 @@ { name: 'fields', type: 'array' } |
{ | ||
"name": "@zenstackhq/language", | ||
"version": "2.8.1", | ||
"version": "2.9.0", | ||
"displayName": "ZenStack modeling language compiler", | ||
@@ -5,0 +5,0 @@ "description": "ZenStack modeling language compiler", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
183093
5288