Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"request": "attach",
"skipFiles": ["<node_internals>/**"],
"sourceMaps": true,
"outFiles": ["${workspaceFolder}/bundle/**/*.js"]
"outFiles": ["${workspaceFolder}/packages/schema/bundle/**/*.js"]
},
{
"name": "Todo sample: debug server-side",
Expand Down
19 changes: 17 additions & 2 deletions packages/language/src/generated/ast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ export function isMemberAccessExpr(item: unknown): item is MemberAccessExpr {
export interface Model extends AstNode {
readonly $type: 'Model';
declarations: Array<AbstractDeclaration>
imports: Array<ModelImport>
}

export const Model = 'Model';
Expand All @@ -420,6 +421,18 @@ export function isModel(item: unknown): item is Model {
return reflection.isInstance(item, Model);
}

export interface ModelImport extends AstNode {
readonly $container: Model;
readonly $type: 'ModelImport';
path: string
}

export const ModelImport = 'ModelImport';

export function isModelImport(item: unknown): item is ModelImport {
return reflection.isInstance(item, ModelImport);
}

export interface NullExpr extends AstNode {
readonly $container: Argument | ArrayExpr | AttributeArg | BinaryExpr | DataSourceField | FieldInitializer | FunctionDecl | GeneratorField | MemberAccessExpr | PluginField | UnaryExpr | UnsupportedFieldType;
readonly $type: 'NullExpr';
Expand Down Expand Up @@ -563,6 +576,7 @@ export interface ZModelAstType {
LiteralExpr: LiteralExpr
MemberAccessExpr: MemberAccessExpr
Model: Model
ModelImport: ModelImport
NullExpr: NullExpr
ObjectExpr: ObjectExpr
Plugin: Plugin
Expand All @@ -579,7 +593,7 @@ export interface ZModelAstType {
export class ZModelAstReflection extends AbstractAstReflection {

getAllTypes(): string[] {
return ['AbstractDeclaration', 'Argument', 'ArrayExpr', 'Attribute', 'AttributeArg', 'AttributeAttribute', 'AttributeParam', 'AttributeParamType', 'BinaryExpr', 'DataModel', 'DataModelAttribute', 'DataModelField', 'DataModelFieldAttribute', 'DataModelFieldType', 'DataSource', 'DataSourceField', 'Enum', 'EnumField', 'Expression', 'FieldInitializer', 'FunctionDecl', 'FunctionParam', 'FunctionParamType', 'GeneratorDecl', 'GeneratorField', 'InvocationExpr', 'LiteralExpr', 'MemberAccessExpr', 'Model', 'NullExpr', 'ObjectExpr', 'Plugin', 'PluginField', 'ReferenceArg', 'ReferenceExpr', 'ReferenceTarget', 'ThisExpr', 'TypeDeclaration', 'UnaryExpr', 'UnsupportedFieldType'];
return ['AbstractDeclaration', 'Argument', 'ArrayExpr', 'Attribute', 'AttributeArg', 'AttributeAttribute', 'AttributeParam', 'AttributeParamType', 'BinaryExpr', 'DataModel', 'DataModelAttribute', 'DataModelField', 'DataModelFieldAttribute', 'DataModelFieldType', 'DataSource', 'DataSourceField', 'Enum', 'EnumField', 'Expression', 'FieldInitializer', 'FunctionDecl', 'FunctionParam', 'FunctionParamType', 'GeneratorDecl', 'GeneratorField', 'InvocationExpr', 'LiteralExpr', 'MemberAccessExpr', 'Model', 'ModelImport', 'NullExpr', 'ObjectExpr', 'Plugin', 'PluginField', 'ReferenceArg', 'ReferenceExpr', 'ReferenceTarget', 'ThisExpr', 'TypeDeclaration', 'UnaryExpr', 'UnsupportedFieldType'];
}

protected override computeIsSubtype(subtype: string, supertype: string): boolean {
Expand Down Expand Up @@ -813,7 +827,8 @@ export class ZModelAstReflection extends AbstractAstReflection {
return {
name: 'Model',
mandatory: [
{ name: 'declarations', type: 'array' }
{ name: 'declarations', type: 'array' },
{ name: 'imports', type: 'array' }
]
};
}
Expand Down
Loading