package jetbrains.mps.lang.scopes.runtime; /*Generated by MPS */ import org.jetbrains.mps.openapi.language.SContainmentLink; import org.jetbrains.mps.openapi.model.SNode; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SNodeOperations; import jetbrains.mps.scope.Scope; import org.jetbrains.mps.openapi.language.SAbstractConcept; public class ScopeUtils { private ScopeUtils() { } public static boolean comeFrom(SContainmentLink expectedLink, SNode thisNode, SNode child) { while ((child != null) && SNodeOperations.getParent(child) != thisNode) { child = SNodeOperations.getParent(child); } return (child != null) && expectedLink.equals(child.getContainmentLink()); } public static boolean comeFrom(SContainmentLink expectedLink, SNode thisNode, SContainmentLink link, int index) { return expectedLink.equals(link); } public static Scope parentScope(SNode node, SAbstractConcept kind) { return Scope.getScope(Scope.parent(node), node, kind); } public static Scope lazyParentScope(SNode node, SAbstractConcept kind) { return new LazyParentScope(node, kind); } }