@zenstackhq/language 3.3.0-beta.4 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -5366,7 +5366,7 @@ function resolved(ref) {
5366
5366
  return ref.ref;
5367
5367
  }
5368
5368
  __name(resolved, "resolved");
5369
- function getRecursiveBases(decl, includeDelegate = true, seen = /* @__PURE__ */ new Set()) {
5369
+ function getRecursiveBases(decl, includeDelegate = true, documents, seen = /* @__PURE__ */ new Set()) {
5370
5370
  const result = [];
5371
5371
  if (seen.has(decl)) {
5372
5372
  return result;
@@ -5379,13 +5379,19 @@ function getRecursiveBases(decl, includeDelegate = true, seen = /* @__PURE__ */
5379
5379
  ] : []
5380
5380
  ];
5381
5381
  bases.forEach((base) => {
5382
- const baseDecl = decl.$container.declarations.find((d) => (isTypeDef(d) || isDataModel(d)) && d.name === base.$refText);
5382
+ let baseDecl;
5383
+ if (base.ref && (isTypeDef(base.ref) || isDataModel(base.ref))) {
5384
+ baseDecl = base.ref;
5385
+ } else {
5386
+ const declarations = documents ? getAllDeclarationsIncludingImports(documents, decl.$container) : decl.$container.declarations;
5387
+ baseDecl = declarations.find((d) => (isTypeDef(d) || isDataModel(d)) && d.name === base.$refText);
5388
+ }
5383
5389
  if (baseDecl) {
5384
5390
  if (!includeDelegate && isDelegateModel(baseDecl)) {
5385
5391
  return;
5386
5392
  }
5387
5393
  result.push(baseDecl);
5388
- result.push(...getRecursiveBases(baseDecl, includeDelegate, seen));
5394
+ result.push(...getRecursiveBases(baseDecl, includeDelegate, documents, seen));
5389
5395
  }
5390
5396
  });
5391
5397
  return result;
@@ -9042,7 +9048,7 @@ var ZModelScopeComputation = class extends DefaultScopeComputation {
9042
9048
  processNode(node, document, scopes) {
9043
9049
  super.processNode(node, document, scopes);
9044
9050
  if (isDataModel(node) || isTypeDef(node)) {
9045
- const bases = getRecursiveBases(node);
9051
+ const bases = getRecursiveBases(node, true, this.services.shared.workspace.LangiumDocuments);
9046
9052
  for (const base of bases) {
9047
9053
  for (const field of base.fields) {
9048
9054
  scopes.add(node, this.descriptions.createDescription(field, this.nameProvider.getName(field)));