Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 packages/ide/vscode/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "zenstack-v3",
"publisher": "zenstack",
"version": "3.0.6",
"version": "3.0.8",
"displayName": "ZenStack V3 Language Tools",
"description": "VSCode extension for ZenStack (v3) ZModel language",
"private": true,
Expand Down
20 changes: 12 additions & 8 deletions packages/language/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -517,13 +517,15 @@ export function getAllFields(

const fields: DataField[] = [];
for (const mixin of decl.mixins) {
invariant(mixin.ref, `Mixin ${mixin.$refText} is not resolved`);
fields.push(...getAllFields(mixin.ref, includeIgnored, seen));
if (mixin.ref) {
fields.push(...getAllFields(mixin.ref, includeIgnored, seen));
}
}

if (isDataModel(decl) && decl.baseModel) {
invariant(decl.baseModel.ref, `Base model ${decl.baseModel.$refText} is not resolved`);
fields.push(...getAllFields(decl.baseModel.ref, includeIgnored, seen));
if (decl.baseModel.ref) {
fields.push(...getAllFields(decl.baseModel.ref, includeIgnored, seen));
}
}

fields.push(...decl.fields.filter((f) => includeIgnored || !hasAttribute(f, '@ignore')));
Expand All @@ -541,13 +543,15 @@ export function getAllAttributes(

const attributes: DataModelAttribute[] = [];
for (const mixin of decl.mixins) {
invariant(mixin.ref, `Mixin ${mixin.$refText} is not resolved`);
attributes.push(...getAllAttributes(mixin.ref, seen));
if (mixin.ref) {
attributes.push(...getAllAttributes(mixin.ref, seen));
}
}

if (isDataModel(decl) && decl.baseModel) {
invariant(decl.baseModel.ref, `Base model ${decl.baseModel.$refText} is not resolved`);
attributes.push(...getAllAttributes(decl.baseModel.ref, seen));
if (decl.baseModel.ref) {
attributes.push(...getAllAttributes(decl.baseModel.ref, seen));
}
}

attributes.push(...decl.attributes);
Expand Down
Loading