package jetbrains.mps.kotlin.behavior;

/*Generated by MPS */

import org.jetbrains.mps.openapi.language.SAbstractConcept;
import org.jetbrains.mps.openapi.model.SNode;
import jetbrains.mps.scope.Scope;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SNodeOperations;
import jetbrains.mps.internal.collections.runtime.Sequence;
import org.jetbrains.mps.openapi.language.SInterfaceConcept;
import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory;

public class ResolvingUtil {
  public static boolean isResolvableByScope(String name, SAbstractConcept scopeConcept, SNode context) {
    Scope varScope = Scope.getScope(SNodeOperations.getParent(context), context, CONCEPTS.IVariableIdentifier$v2);
    return Sequence.fromIterable(varScope.getAvailableElements(name)).isNotEmpty();
  }

  private static final class CONCEPTS {
    /*package*/ static final SInterfaceConcept IVariableIdentifier$v2 = MetaAdapterFactory.getInterfaceConcept(0x6b3888c1980244d8L, 0x8baff8e6c33ed689L, 0x2043bc83114d2ab6L, "jetbrains.mps.kotlin.structure.IVariableIdentifier");
  }
}
