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

Method getScope

packages/language/src/zmodel-scope.ts:124–138  ·  view source on GitHub ↗
(context: ReferenceInfo)

Source from the content-addressed store, hash-verified

122 }
123
124 override getScope(context: ReferenceInfo): Scope {
125 if (isMemberAccessExpr(context.container) && context.container.operand && context.property === 'member') {
126 return this.getMemberAccessScope(context);
127 }
128
129 if (isReferenceExpr(context.container) && context.property === 'target') {
130 // when reference expression is resolved inside a collection predicate, the scope is the collection
131 const containerCollectionPredicate = getCollectionPredicateContext(context.container);
132 if (containerCollectionPredicate) {
133 return this.getCollectionPredicateScope(context, containerCollectionPredicate);
134 }
135 }
136
137 return super.getScope(context);
138 }
139
140 private getMemberAccessScope(context: ReferenceInfo) {
141 const referenceType = this.reflection.getReferenceType(context);

Callers

nothing calls this directly

Calls 5

getMemberAccessScopeMethod · 0.95
isMemberAccessExprFunction · 0.90
isReferenceExprFunction · 0.90

Tested by

no test coverage detected