MCPcopy Create free account
hub / github.com/zenstackhq/zenstack / resolveReference

Method resolveReference

packages/language/src/zmodel-linker.ts:251–270  ·  view source on GitHub ↗
(node: ReferenceExpr, document: LangiumDocument<AstNode>, extraScopes: ScopeProvider[])

Source from the content-addressed store, hash-verified

249 }
250
251 private resolveReference(node: ReferenceExpr, document: LangiumDocument<AstNode>, extraScopes: ScopeProvider[]) {
252 this.resolveDefault(node, document, extraScopes);
253 const target = node.target.ref;
254
255 if (target) {
256 if (isCollectionPredicateBinding(target)) {
257 // collection predicate's binding is resolved to the element type of the collection
258 const collectionType = target.$container.left.$resolvedType;
259 if (collectionType) {
260 node.$resolvedType = { ...collectionType, array: false };
261 }
262 } else if (isEnumField(target)) {
263 // enum field is resolved to its containing enum
264 this.resolveToBuiltinTypeOrDecl(node, target.$container);
265 } else if (isDataField(target) || isFunctionParam(target)) {
266 // other references are resolved to their declared type
267 this.resolveToDeclaredType(node, target.type);
268 }
269 }
270 }
271
272 private resolveArray(node: ArrayExpr, document: LangiumDocument<AstNode>, extraScopes: ScopeProvider[]) {
273 node.items.forEach((item) => this.resolve(item, document, extraScopes));

Callers 1

resolveMethod · 0.95

Calls 7

resolveDefaultMethod · 0.95
resolveToDeclaredTypeMethod · 0.95
isEnumFieldFunction · 0.90
isDataFieldFunction · 0.90
isFunctionParamFunction · 0.90

Tested by

no test coverage detected