Java 类com.intellij.psi.ResolveState 实例源码

项目:AppleScript-IDEA    文件:AppleScriptComponentScopeProcessor.java   
@Override
protected boolean doExecute(@NotNull AppleScriptPsiElement element, final @NotNull ResolveState state) {
  if (element instanceof AppleScriptTargetVariable) {
    final AppleScriptTargetVariable targetVar = (AppleScriptTargetVariable) element;
    if (!myCollectedTargets.containsKey(targetVar.getName())) {
      myCollectedTargets.put(targetVar.getName(), targetVar);
      myResult.add(targetVar);
    } else if (targetVar.getContainingFile() != myCollectedTargets.get(targetVar.getName()).getContainingFile()) {
      myResult.add(targetVar);//should not happen if the file is the same
      // if there already variable with the same name defined it should be located in the same local context
      // (file, handler etc)
      throw new AssertionError("Elements are defined in different files:");
    }
  } else if (element instanceof AppleScriptComponent && !(element instanceof DictionaryComponent)) {
    myResult.add((AppleScriptComponent) element);
  }

  return true;
}
项目:AppleScript-IDEA    文件:AppleScriptResolveProcessor.java   
@Override
protected boolean doExecute(@NotNull AppleScriptPsiElement element, @NotNull ResolveState state) {
  if (element instanceof AppleScriptComponent) {
    if (this.myName.equals(element.getName())) {
      if (element instanceof AppleScriptTargetVariable) {
        myTargets.add((AppleScriptTargetVariable) element);
        //set the closest from added before definition and continue the search
        myResult = myTargets.get(0);
        return true;
      }
      myResult = (AppleScriptComponent) element;
      return false;
    }
  }
  return true;
}
项目:lua-for-idea    文件:LuaAnonymousFunctionExpressionImpl.java   
public boolean processDeclarations(@NotNull
PsiScopeProcessor processor, @NotNull
ResolveState resolveState, PsiElement lastParent, @NotNull
PsiElement place) {
    if ((lastParent != null) && (lastParent.getParent() == this)) {
        final LuaParameter[] params = getParameters().getLuaParameters();

        for (LuaParameter param : params) {
            if (!processor.execute(param, resolveState)) {
                return false;
            }
        }
    }

    return true;
}
项目:lua-for-idea    文件:LuaFunctionDefinitionStatementImpl.java   
public boolean processDeclarations(@NotNull PsiScopeProcessor processor, @NotNull ResolveState resolveState, PsiElement lastParent, @NotNull PsiElement place) {

        LuaSymbol v = getIdentifier();
        if (!processor.execute(v, resolveState)) return false;

        PsiElement parent = place.getParent();

        if (parent != null && PsiTreeUtil.isAncestor(getBlock(), parent, false)) {
            final LuaParameter[] params = getParameters().getLuaParameters();
            for (LuaParameter param : params) {
                if (!processor.execute(param, resolveState)) return false;
            }
            LuaParameter self = findChildByClass(LuaImpliedSelfParameterImpl.class);

            if (self != null) {
                if (!processor.execute(self, resolveState)) return false;
            }
        }

        return true;
    }
项目:lua-for-idea    文件:LuaGenericForStatementImpl.java   
public boolean processDeclarations(@NotNull PsiScopeProcessor processor,
                                   @NotNull ResolveState resolveState,
                                   PsiElement lastParent,
                                   @NotNull PsiElement place) {

    PsiElement parent = place.getParent();
    while(parent != null && !(parent instanceof LuaPsiFile)) {
        if (parent == getBlock() ) {
            LuaExpression[] names = getIndices();
            for (LuaExpression name : names) {
                 if (!processor.execute(name, resolveState)) return false;
            }
        }

        parent = parent.getParent();
    }
   return true;
}
项目:lua-for-idea    文件:LuaNumericForStatementImpl.java   
public boolean processDeclarations(@NotNull PsiScopeProcessor processor,
                                   @NotNull ResolveState resolveState,
                                   PsiElement lastParent,
                                   @NotNull PsiElement place) {

    PsiElement parent = place.getParent();
    while (parent != null && !(parent instanceof LuaPsiFile)) {
        if (parent == getBlock()) {
            if (!processor.execute(getIndex(), resolveState)) return false;
        }

        parent = parent.getParent();
    }

    return true;
}
项目:intellij-ce-playground    文件:AssignmentCollectProcessor.java   
@Override
public boolean execute(@NotNull final PsiElement element, @NotNull final ResolveState state) {
  if (element instanceof PyAssignmentStatement) {
    final PyAssignmentStatement assignment = (PyAssignmentStatement)element;
    for (PyExpression ex : assignment.getTargets()) {
      if (ex instanceof PyTargetExpression) {
        final PyTargetExpression target = (PyTargetExpression)ex;
        final QualifiedName qualifiedName = target.asQualifiedName();
        if (qualifiedName != null) {
          if (qualifiedName.getComponentCount() == myQualifier.getComponentCount() + 1 && qualifiedName.matchesPrefix(myQualifier)) {
            String last_elt_name = target.getName();
            if (!mySeenNames.contains(last_elt_name)) { // no dupes, only remember the latest
              myResult.add(target);
              mySeenNames.add(last_elt_name);
            }
          }
        }
      }

    }
  }
  return true; // nothing interesting found, continue
}
项目:intellij-ce-playground    文件:RncNameImpl.java   
@Override
public boolean execute(@NotNull PsiElement element, @NotNull ResolveState substitutor) {
  final ASTNode node = element.getNode();
  if (node == null) return true;

  if (!(element instanceof RncDecl)) {
    return false;
  }

  final IElementType type = node.getElementType();
  if (myKind == Kind.NAMESPACE && type == RncElementTypes.NS_DECL) {
    if (checkDecl(element)) return false;
  } else if (myKind == Kind.DATATYPES && type == RncElementTypes.DATATYPES_DECL) {
    if (checkDecl(element)) return false;
  }

  return true;
}
项目:intellij-ce-playground    文件:RncFileImpl.java   
@Override
public boolean processDeclarations(@NotNull PsiScopeProcessor processor, @NotNull ResolveState substitutor, PsiElement lastParent, @NotNull PsiElement place) {
  //processor.handleEvent(JavaScopeProcessorEvent.SET_CURRENT_FILE_CONTEXT, this);
  try {
    final ASTNode docNode = getDocument().getNode();
    assert docNode != null;
    final ASTNode[] nodes = docNode.getChildren(DECLS);
    for (ASTNode node : nodes) {
      if (!processor.execute(node.getPsi(), substitutor)) {
        return false;
      }
    }

    final RncGrammar grammar = getGrammar();
    if (grammar != null) {
      return grammar.processDeclarations(processor, substitutor, lastParent, place);
    } else {
      return true;
    }
  } finally {
    //processor.handleEvent(JavaScopeProcessorEvent.SET_CURRENT_FILE_CONTEXT, null);
  }
}
项目:intellij-ce-playground    文件:GradleMavenArtifactRepositoryContributor.java   
@Override
public void process(@NotNull List<String> methodCallInfo,
                    @NotNull PsiScopeProcessor processor,
                    @NotNull ResolveState state,
                    @NotNull PsiElement place) {
  if (methodCallInfo.isEmpty() || methodCallInfo.size() < 3 ||
      !"repositories".equals(methodCallInfo.get(2)) || !"maven".equals(methodCallInfo.get(1))) {
    return;
  }
  GroovyPsiManager psiManager = GroovyPsiManager.getInstance(place.getProject());
  GradleResolverUtil.processDeclarations(
    psiManager, processor, state, place,
    GradleCommonClassNames.GRADLE_API_ARTIFACTS_REPOSITORIES_MAVEN_ARTIFACT_REPOSITORY);
  PsiClass contributorClass = psiManager.findClassWithCache(
    GradleCommonClassNames.GRADLE_API_ARTIFACTS_REPOSITORIES_MAVEN_ARTIFACT_REPOSITORY, place.getResolveScope());
  if (contributorClass == null) return;
  GradleResolverUtil.processMethod(methodCallInfo.get(0), contributorClass, processor, state, place);
}
项目:intellij-ce-playground    文件:GradleMavenDeployerContributor.java   
@Override
public void process(@NotNull List<String> methodCallInfo,
                    @NotNull PsiScopeProcessor processor,
                    @NotNull ResolveState state,
                    @NotNull PsiElement place) {
  if (methodCallInfo.isEmpty() || methodCallInfo.size() < 3 ||
      !"repositories".equals(methodCallInfo.get(2)) || !"mavenDeployer".equals(methodCallInfo.get(1))) {
    return;
  }
  GroovyPsiManager psiManager = GroovyPsiManager.getInstance(place.getProject());
  GradleResolverUtil.processDeclarations(
    psiManager, processor, state, place,
    GradleCommonClassNames.GRADLE_API_ARTIFACTS_MAVEN_MAVEN_DEPLOYER);
  PsiClass contributorClass = psiManager.findClassWithCache(
    GradleCommonClassNames.GRADLE_API_ARTIFACTS_MAVEN_MAVEN_DEPLOYER, place.getResolveScope());
  if (contributorClass == null) return;
  GradleResolverUtil.processMethod(methodCallInfo.get(0), contributorClass, processor, state, place);
}
项目:intellij-ce-playground    文件:GradleSimpleContributor.java   
@Override
public void process(@NotNull List<String> methodCallInfo,
                    @NotNull PsiScopeProcessor processor,
                    @NotNull ResolveState state,
                    @NotNull PsiElement place) {
  if (methodCallInfo.isEmpty() || methodCallInfo.size() < 2 || !blockName.equals(methodCallInfo.get(1))) {
    return;
  }
  GroovyPsiManager psiManager = GroovyPsiManager.getInstance(place.getProject());
  GradleResolverUtil.processDeclarations(psiManager, processor, state, place, fqName);
  for(final String mixin : myMixIns) {
    PsiClass contributorClass =
      psiManager.findClassWithCache(mixin, place.getResolveScope());
    if (contributorClass == null) continue;
    GradleResolverUtil.processMethod(methodCallInfo.get(0), contributorClass, processor, state, place);
  }
}
项目:intellij-ce-playground    文件:GradleImplicitContributor.java   
private static void processTask(@NotNull String taskName,
                                @NotNull String fqName,
                                @NotNull GroovyPsiManager psiManager,
                                @NotNull PsiScopeProcessor processor,
                                @NotNull ResolveState state,
                                @NotNull PsiElement place) {
  if (taskName.equals(place.getText())) {
    if (!(place instanceof GrClosableBlock)) {
      GrLightMethodBuilder methodBuilder = GradleResolverUtil.createMethodWithClosure(taskName, fqName, null, place, psiManager);
      if (methodBuilder == null) return;
      processor.execute(methodBuilder, state);
      PsiClass contributorClass =
        psiManager.findClassWithCache(fqName, place.getResolveScope());
      if (contributorClass == null) return;
      GradleResolverUtil.processMethod(taskName, contributorClass, processor, state, place);
    }
  }
  else {
    GradleResolverUtil.processDeclarations(psiManager, processor, state, place, fqName);
  }
}
项目:intellij-ce-playground    文件:GdkMethodDslProvider.java   
private static void processCategoryMethods(final String className, final GdslMembersHolderConsumer consumer, final boolean isStatic) {
  final GlobalSearchScope scope = consumer.getResolveScope();
  final PsiClass categoryClass = GroovyPsiManager.getInstance(consumer.getProject()).findClassWithCache(className, scope);
  if (categoryClass == null) {
    return;
  }

  final VolatileNotNullLazyValue<GdkMethodHolder> methodsMap = new VolatileNotNullLazyValue<GdkMethodHolder>() {
    @NotNull
    @Override
    protected GdkMethodHolder compute() {
      return GdkMethodHolder.getHolderForClass(categoryClass, isStatic, scope);
    }
  };

  consumer.addMemberHolder(new CustomMembersHolder() {

    @Override
    public boolean processMembers(GroovyClassDescriptor descriptor, PsiScopeProcessor processor, ResolveState state) {
      return methodsMap.getValue().processMethods(processor, state, descriptor.getPsiType(), descriptor.getProject());
    }
  });
}
项目:intellij-ce-playground    文件:GrForStatementImpl.java   
@Override
public boolean processDeclarations(@NotNull PsiScopeProcessor processor,
                                   @NotNull ResolveState state,
                                   @Nullable PsiElement lastParent,
                                   @NotNull PsiElement place) {
  if (!ResolveUtil.shouldProcessProperties(processor.getHint(ClassHint.KEY))) return true;

  GrForClause forClause = getClause();
  final GrVariable varScope = PsiTreeUtil.getParentOfType(place, GrVariable.class);
  if (forClause == null) return true;
  if (lastParent == null || lastParent instanceof GrForInClause) return true;

  GrVariable var = forClause.getDeclaredVariable();
  if (var == null || var.equals(varScope)) return true;
  if (!ResolveUtil.processElement(processor, var, state)) return false;

  return true;
}
项目:consulo-unity3d    文件:Unity3dSceneCSharpFieldReference.java   
@RequiredReadAction
private static CSharpFieldDeclaration findField(CSharpTypeDeclaration owner, String name)
{
    AsPsiElementProcessor psiElementProcessor = new AsPsiElementProcessor();
    MemberResolveScopeProcessor memberResolveScopeProcessor = new MemberResolveScopeProcessor(owner, psiElementProcessor, new ExecuteTarget[]{ExecuteTarget.FIELD}, OverrideProcessor.ALWAYS_TRUE);

    ResolveState state = ResolveState.initial();
    state = state.put(CSharpResolveUtil.EXTRACTOR, DotNetGenericExtractor.EMPTY);
    state = state.put(CSharpResolveUtil.SELECTOR, new MemberByNameSelector(name));

    CSharpResolveUtil.walkChildren(memberResolveScopeProcessor, owner, false, true, state);
    for(PsiElement element : psiElementProcessor.getElements())
    {
        if(element instanceof CSharpFieldDeclaration)
        {
            return (CSharpFieldDeclaration) element;
        }
    }
    return null;
}
项目:tools-idea    文件:RncNameImpl.java   
public boolean execute(@NotNull PsiElement element, ResolveState substitutor) {
  final ASTNode node = element.getNode();
  if (node == null) return true;

  if (!(element instanceof RncDecl)) {
    return false;
  }

  final IElementType type = node.getElementType();
  if (myKind == Kind.NAMESPACE && type == RncElementTypes.NS_DECL) {
    if (checkDecl(element)) return false;
  } else if (myKind == Kind.DATATYPES && type == RncElementTypes.DATATYPES_DECL) {
    if (checkDecl(element)) return false;
  }

  return true;
}
项目:tools-idea    文件:RncFileImpl.java   
@Override
public boolean processDeclarations(@NotNull PsiScopeProcessor processor, @NotNull ResolveState substitutor, PsiElement lastParent, @NotNull PsiElement place) {
  //processor.handleEvent(JavaScopeProcessorEvent.SET_CURRENT_FILE_CONTEXT, this);
  try {
    final ASTNode docNode = getDocument().getNode();
    assert docNode != null;
    final ASTNode[] nodes = docNode.getChildren(DECLS);
    for (ASTNode node : nodes) {
      if (!processor.execute(node.getPsi(), substitutor)) {
        return false;
      }
    }

    final RncGrammar grammar = getGrammar();
    if (grammar != null) {
      return grammar.processDeclarations(processor, substitutor, lastParent, place);
    } else {
      return true;
    }
  } finally {
    //processor.handleEvent(JavaScopeProcessorEvent.SET_CURRENT_FILE_CONTEXT, null);
  }
}
项目:tools-idea    文件:GdkMethodDslProvider.java   
private static void processCategoryMethods(final String className, final GdslMembersHolderConsumer consumer, final boolean isStatic) {
  final GlobalSearchScope scope = consumer.getResolveScope();
  final PsiClass categoryClass = GroovyPsiManager.getInstance(consumer.getProject()).findClassWithCache(className, scope);
  if (categoryClass == null) {
    return;
  }

  final VolatileNotNullLazyValue<GdkMethodHolder> methodsMap = new VolatileNotNullLazyValue<GdkMethodHolder>() {
    @NotNull
    @Override
    protected GdkMethodHolder compute() {
      return GdkMethodHolder.getHolderForClass(categoryClass, isStatic, scope);
    }
  };

  consumer.addMemberHolder(new CustomMembersHolder() {

    @Override
    public boolean processMembers(GroovyClassDescriptor descriptor, PsiScopeProcessor processor, ResolveState state) {
      return methodsMap.getValue().processMethods(processor, state, descriptor.getPsiType(), descriptor.getProject());
    }
  });
}
项目:consulo-csharp    文件:CompletionResolveScopeProcessor.java   
@Override
@RequiredReadAction
public boolean execute(@NotNull PsiElement element, ResolveState state)
{
    DotNetGenericExtractor extractor = state.get(CSharpResolveUtil.EXTRACTOR);
    assert extractor != null;

    for(PsiElement psiElement : OverrideUtil.getAllMembers(element, myScope, extractor, true, false))
    {
        ProgressManager.checkCanceled();

        if(!ExecuteTargetUtil.isMyElement(this, psiElement))
        {
            continue;
        }

        processElement(psiElement);
    }
    return true;
}
项目:consulo-csharp    文件:ParameterFromParentKindProcessor.java   
@RequiredReadAction
@Override
public void process(@NotNull CSharpResolveOptions options,
        @NotNull DotNetGenericExtractor defaultExtractor,
        @Nullable PsiElement forceQualifierElement,
        @NotNull Processor<ResolveResult> processor)
{
    PsiElement element = options.getElement();

    DotNetParameterListOwner parameterListOwner = CSharpReferenceExpressionImplUtil.findParentOrNextIfDoc(element, DotNetParameterListOwner
            .class);
    if(parameterListOwner == null)
    {
        return;
    }

    SimpleNamedScopeProcessor scopeProcessor = new SimpleNamedScopeProcessor(processor, options.isCompletion(),
            ExecuteTarget.LOCAL_VARIABLE_OR_PARAMETER);
    ResolveState state = ResolveState.initial();
    state = state.put(CSharpResolveUtil.SELECTOR, options.getSelector());

    parameterListOwner.processDeclarations(scopeProcessor, state, null, element);
}
项目:consulo-csharp    文件:GenericFromParentKindProcessor.java   
@RequiredReadAction
@Override
public void process(@NotNull CSharpResolveOptions options,
        @NotNull DotNetGenericExtractor defaultExtractor,
        @Nullable PsiElement forceQualifierElement,
        @NotNull Processor<ResolveResult> processor)
{
    PsiElement element = options.getElement();

    DotNetGenericParameterListOwner genericParameterListOwner = CSharpReferenceExpressionImplUtil.findParentOrNextIfDoc(element,
            DotNetGenericParameterListOwner.class);
    if(genericParameterListOwner == null)
    {
        return;
    }

    SimpleNamedScopeProcessor scopeProcessor = new SimpleNamedScopeProcessor(processor, options.isCompletion(), ExecuteTarget.GENERIC_PARAMETER);
    ResolveState state = ResolveState.initial();
    state = state.put(CSharpResolveUtil.SELECTOR, options.getSelector());
    genericParameterListOwner.processDeclarations(scopeProcessor, state, null, element);
}
项目:consulo-csharp    文件:CSharpResolveUtil.java   
public static boolean walkForLabel(@NotNull final PsiScopeProcessor processor, @NotNull final PsiElement entrance, @NotNull ResolveState state)
{
    PsiElement[] children = entrance.getChildren();
    for(PsiElement child : children)
    {
        if(ExecuteTargetUtil.isMyElement(processor, child))
        {
            if(!processor.execute(child, state))
            {
                return false;
            }
        }

        if(!walkForLabel(processor, child, state))
        {
            return false;
        }
    }
    return true;
}
项目:consulo-csharp    文件:CSharpForeachStatementImpl.java   
@Override
public boolean processDeclarations(@NotNull PsiScopeProcessor processor, @NotNull ResolveState state, PsiElement lastParent,
        @NotNull PsiElement place)
{
    if(lastParent == null || !PsiTreeUtil.isAncestor(this, lastParent, false))
    {
        return true;
    }
    CSharpLocalVariable variable = getVariable();
    if(variable != null)
    {
        if(!processor.execute(variable, state))
        {
            return false;
        }
    }
    return true;
}
项目:consulo-csharp    文件:CSharpLinqQueryBodyImpl.java   
@Override
public boolean processDeclarations(@NotNull PsiScopeProcessor processor,
        @NotNull ResolveState state,
        PsiElement lastParent,
        @NotNull PsiElement place)
{
    if(lastParent == null || !PsiTreeUtil.isAncestor(this, lastParent, false))
    {
        return true;
    }

    for(PsiElement psiElement : getChildren())
    {
        if(!psiElement.processDeclarations(processor, state, lastParent, place))
        {
            return false;
        }
    }
    return super.processDeclarations(processor, state, lastParent, place);
}
项目:consulo-csharp    文件:CSharpUsingStatementImpl.java   
@Override
public boolean processDeclarations(@NotNull PsiScopeProcessor processor, @NotNull ResolveState state, PsiElement lastParent,
        @NotNull PsiElement place)
{
    if(lastParent == null || !PsiTreeUtil.isAncestor(this, lastParent, false))
    {
        return true;
    }

    DotNetVariable variable = getVariable();
    if(variable != null)
    {
        if(!processor.execute(variable, state))
        {
            return false;
        }
    }
    return true;
}
项目:consulo-csharp    文件:CSharpBlockStatementImpl.java   
@Override
public boolean processDeclarations(@NotNull PsiScopeProcessor processor, @NotNull ResolveState state, PsiElement lastParent, @NotNull PsiElement
        place)
{
    DotNetStatement[] statements = getStatements();
    List<PsiElement> elements = new ArrayList<>(statements.length);
    for(DotNetStatement statement : statements)
    {
        if(statement == lastParent)
        {
            break;
        }
        elements.add(statement);
    }

    Collections.reverse(elements);

    for(PsiElement dotNetStatement : elements)
    {
        if(!dotNetStatement.processDeclarations(processor, state, lastParent, place))
        {
            return false;
        }
    }
    return true;
}
项目:consulo-csharp    文件:CSharpForStatementImpl.java   
@Override
public boolean processDeclarations(@NotNull PsiScopeProcessor processor, @NotNull ResolveState state, PsiElement lastParent, @NotNull PsiElement
        place)
{
    if(lastParent == null || !PsiTreeUtil.isAncestor(this, lastParent, false))
    {
        return true;
    }

    for(DotNetVariable dotNetVariable : getVariables())
    {
        if(!processor.execute(dotNetVariable, state))
        {
            return false;
        }
    }
    return true;
}
项目:consulo-csharp    文件:CSharpLinqJoinClauseImpl.java   
@Override
public boolean processDeclarations(@NotNull PsiScopeProcessor processor,
        @NotNull ResolveState state,
        PsiElement lastParent,
        @NotNull PsiElement place)
{
    CSharpLinqVariableImpl variable = getVariable();
    if(variable != null)
    {
        if(!processor.execute(variable, state))
        {
            return false;
        }
    }

    CSharpLinqIntoClauseImpl intoClause = getIntoClause();
    if(intoClause != null)
    {
        if(!intoClause.processDeclarations(processor, state, lastParent, place))
        {
            return false;
        }
    }
    return true;
}
项目:consulo-csharp    文件:CSharpCatchStatementImpl.java   
@Override
public boolean processDeclarations(@NotNull PsiScopeProcessor processor, @NotNull ResolveState state, PsiElement lastParent, @NotNull PsiElement place)
{
    if(lastParent == null || !PsiTreeUtil.isAncestor(this, lastParent, false))
    {
        return true;
    }
    CSharpLocalVariable variable = getVariable();
    if(variable != null && variable.getNameIdentifier() != null)   // variable can be without name
    {
        if(!processor.execute(variable, state))
        {
            return false;
        }
    }
    return true;
}
项目:consulo-csharp    文件:CSharpLinqExpressionImpl.java   
@Override
public boolean processDeclarations(@NotNull PsiScopeProcessor processor,
        @NotNull ResolveState state,
        PsiElement lastParent,
        @NotNull PsiElement place)
{
    if(lastParent == null || !PsiTreeUtil.isAncestor(this, lastParent, false))
    {
        return true;
    }

    for(PsiElement psiElement : getChildren())
    {
        if(!psiElement.processDeclarations(processor, state, lastParent, place))
        {
            return false;
        }
    }
    return super.processDeclarations(processor, state, lastParent, place);
}
项目:consulo-csharp    文件:CSharpFixedStatementImpl.java   
@Override
public boolean processDeclarations(@NotNull PsiScopeProcessor processor, @NotNull ResolveState state, PsiElement lastParent,
        @NotNull PsiElement place)
{
    if(lastParent == null || !PsiTreeUtil.isAncestor(this, lastParent, false))
    {
        return true;
    }

    for(DotNetVariable dotNetVariable : getVariables())
    {
        if(!processor.execute(dotNetVariable, state))
        {
            return false;
        }
    }
    return true;
}
项目:AppleScript-IDEA    文件:AppleScriptFile.java   
@Override
public boolean processDeclarations(@NotNull PsiScopeProcessor processor, 
                                   @NotNull ResolveState state, 
                                   PsiElement lastParent, 
                                   @NotNull PsiElement place) {
  return AppleScriptPsiElementImpl.processDeclarationsImpl(this, processor, state, lastParent, place) 
      && super.processDeclarations(processor, state, lastParent, place);
}
项目:AppleScript-IDEA    文件:AppleScriptResolver.java   
private List<? extends PsiElement> resolveSimpleReference(@NotNull final PsiElement scopeElement, @NotNull final String name) {
  final List<PsiElement> result = new ArrayList<>();

  final AppleScriptResolveProcessor resolveProcessor = new AppleScriptResolveProcessor(name);
  PsiTreeUtil.treeWalkUp(resolveProcessor, scopeElement, null, ResolveState.initial());
  result.add(resolveProcessor.getResult());
  return result;
}
项目:AppleScript-IDEA    文件:AppleScriptComponentScopeResolver.java   
@Override
public List<? extends PsiElement> resolve(@NotNull AppleScriptReferenceElement scopeElement, boolean incompleteCode) {
  final Set<AppleScriptComponent> resultSet = new HashSet<>();

  // local
  PsiElement maxScope = getMaxScope(scopeElement);
  final AppleScriptComponentScopeProcessor resolveProcessor = new AppleScriptComponentScopeProcessor(resultSet);
  PsiTreeUtil.treeWalkUp(resolveProcessor, scopeElement, maxScope, ResolveState.initial());
  return new ArrayList<>(resultSet);
}
项目:AppleScript-IDEA    文件:AppleScriptPsiElementImpl.java   
@Override
public boolean processDeclarations(@NotNull PsiScopeProcessor processor, @NotNull ResolveState state, PsiElement
    lastParent, @NotNull PsiElement place) {

  return processDeclarationsImpl(this, processor, state, lastParent, place)
      && super.processDeclarations(processor, state, lastParent, place);
}
项目:lua-for-idea    文件:LuaDocSymbolReferenceElementImpl.java   
@NotNull
public ResolveResult[] multiResolve(final boolean incompleteCode) {
    final String refName = getName();
    if (refName == null)
        return LuaResolveResult.EMPTY_ARRAY;

    ResolveProcessor processor = new SymbolResolveProcessor(refName, this, incompleteCode);

    final LuaDocCommentOwner docOwner = LuaDocCommentUtil.findDocOwner(this);
    if (docOwner != null) {
        final LuaStatementElement statementElement =
                PsiTreeUtil.getParentOfType(docOwner, LuaStatementElement.class, false);
        if (statementElement != null)
            statementElement.processDeclarations(processor, ResolveState.initial(), this, this);
    }
    if (processor.hasCandidates()) {
        return processor.getCandidates();
    }

    LuaGlobalDeclarationIndex index = LuaGlobalDeclarationIndex.getInstance();
    Collection<LuaDeclarationExpression> names = index.get(refName, getProject(),
            new ProjectAndLibrariesScope(getProject()));
    for (LuaDeclarationExpression name : names) {
        name.processDeclarations(processor, ResolveState.initial(), this, this);
    }

    if (processor.hasCandidates()) {
        return processor.getCandidates();
    }

    return LuaResolveResult.EMPTY_ARRAY;
}
项目:lua-for-idea    文件:ResolveUtil.java   
public static boolean treeWalkUp(PsiElement place, PsiScopeProcessor processor) {
  PsiElement lastParent = null;
  PsiElement run = place;
  while (run != null) {
    if (!run.processDeclarations(processor, ResolveState.initial(), lastParent, place)) return false;
    lastParent = run;
    run = run.getContext(); //same as getParent
  }

  return true;
}
项目:lua-for-idea    文件:ResolveUtil.java   
public static boolean processChildren(PsiElement element, PsiScopeProcessor processor,
                                      ResolveState substitutor, PsiElement lastParent, PsiElement place) {
  PsiElement run = lastParent == null ? element.getLastChild() : lastParent.getPrevSibling();
  while (run != null) {
    if (PsiTreeUtil.findCommonParent(place, run) != run && !run.processDeclarations(processor, substitutor, lastParent, place)) return false;
    run = run.getPrevSibling();
  }

  return true;
}
项目:lua-for-idea    文件:LuaPsiFileImpl.java   
@Override
public boolean processDeclarations(PsiScopeProcessor processor,
                                               ResolveState state, PsiElement lastParent,
                                               PsiElement place) {
    PsiElement run = lastParent == null ? getLastChild() : lastParent.getPrevSibling();
    if (run != null && run.getParent() != this) run = null;
    while (run != null) {
        if (!run.processDeclarations(processor, state, null, place)) return false;
        run = run.getPrevSibling();
    }

    return true;
}