mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[groovy] get rid of ClassHint.ResolveKind
This commit is contained in:
+5
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,6 +18,7 @@ package org.jetbrains.plugins.groovy.dgm;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Couple;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.scope.ElementClassHint;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.util.CachedValueProvider;
|
||||
@@ -27,6 +28,7 @@ import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.NonCodeMembersContributor;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
@@ -42,6 +44,8 @@ public class DGMMemberContributor extends NonCodeMembersContributor {
|
||||
@NotNull PsiScopeProcessor processor,
|
||||
@NotNull PsiElement place,
|
||||
@NotNull ResolveState state) {
|
||||
if (!ResolveUtil.shouldProcessMethods(processor.getHint(ElementClassHint.KEY))) return;
|
||||
|
||||
final Project project = place.getProject();
|
||||
|
||||
ConcurrentMap<GlobalSearchScope, List<GdkMethodHolder>> map = CachedValuesManager.getManager(project).getCachedValue(
|
||||
|
||||
+3
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,6 +16,7 @@
|
||||
package org.jetbrains.plugins.groovy.geb;
|
||||
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.scope.ElementClassHint;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrField;
|
||||
@@ -24,7 +25,6 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrMethod
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.ClassUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.NonCodeMembersContributor;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -44,8 +44,7 @@ public class GebPageMemberContributor extends NonCodeMembersContributor {
|
||||
@NotNull PsiScopeProcessor processor,
|
||||
@NotNull PsiElement place,
|
||||
@NotNull ResolveState state) {
|
||||
ClassHint classHint = processor.getHint(ClassHint.KEY);
|
||||
if (classHint != null && !classHint.shouldProcess(ClassHint.ResolveKind.PROPERTY)) return;
|
||||
if (!ResolveUtil.shouldProcessProperties(processor.getHint(ElementClassHint.KEY))) return;
|
||||
|
||||
PsiElement grCall = place.getParent();
|
||||
if (grCall instanceof GrMethodCall) {
|
||||
|
||||
+7
-29
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -169,7 +169,7 @@ public class GroovyConstructorNamedArgumentProvider extends GroovyNamedArgumentP
|
||||
|
||||
private abstract static class MyPsiScopeProcessor implements PsiScopeProcessor, NameHint, ClassHint, ElementClassHint {
|
||||
private String myNameHint;
|
||||
private EnumSet<ResolveKind> myResolveTargetKinds;
|
||||
private EnumSet<DeclarationKind> myResolveTargetKinds;
|
||||
|
||||
@Override
|
||||
public boolean execute(@NotNull PsiElement element, @NotNull ResolveState state) {
|
||||
@@ -178,7 +178,7 @@ public class GroovyConstructorNamedArgumentProvider extends GroovyNamedArgumentP
|
||||
PsiType type;
|
||||
|
||||
if (element instanceof PsiMethod) {
|
||||
if (!myResolveTargetKinds.contains(ResolveKind.METHOD)) return true;
|
||||
if (!myResolveTargetKinds.contains(DeclarationKind.METHOD)) return true;
|
||||
|
||||
PsiMethod method = (PsiMethod)element;
|
||||
if (!GroovyPropertyUtils.isSimplePropertySetter(method)) return true;
|
||||
@@ -189,7 +189,7 @@ public class GroovyConstructorNamedArgumentProvider extends GroovyNamedArgumentP
|
||||
type = method.getParameterList().getParameters()[0].getType();
|
||||
}
|
||||
else {
|
||||
if (!myResolveTargetKinds.contains(ResolveKind.PROPERTY)) return true;
|
||||
if (!myResolveTargetKinds.contains(DeclarationKind.FIELD)) return true;
|
||||
|
||||
type = ((PsiField)element).getType();
|
||||
propertyName = ((PsiField)element).getName();
|
||||
@@ -214,7 +214,7 @@ public class GroovyConstructorNamedArgumentProvider extends GroovyNamedArgumentP
|
||||
|
||||
@Override
|
||||
public <T> T getHint(@NotNull Key<T> hintKey) {
|
||||
if ((NameHint.KEY == hintKey && myNameHint != null) || ClassHint.KEY == hintKey || ElementClassHint.KEY == hintKey) {
|
||||
if (NameHint.KEY == hintKey && myNameHint != null || ElementClassHint.KEY == hintKey) {
|
||||
//noinspection unchecked
|
||||
return (T) this;
|
||||
}
|
||||
@@ -227,31 +227,9 @@ public class GroovyConstructorNamedArgumentProvider extends GroovyNamedArgumentP
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldProcess(ResolveKind resolveKind) {
|
||||
return myResolveTargetKinds.contains(resolveKind);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldProcess(DeclarationKind kind) {
|
||||
switch (kind) {
|
||||
case CLASS:
|
||||
return shouldProcess(ResolveKind.CLASS);
|
||||
|
||||
case ENUM_CONST:
|
||||
case VARIABLE:
|
||||
case FIELD:
|
||||
return shouldProcess(ResolveKind.PROPERTY);
|
||||
|
||||
case METHOD:
|
||||
return shouldProcess(ResolveKind.METHOD);
|
||||
|
||||
case PACKAGE:
|
||||
return shouldProcess(ResolveKind.PACKAGE);
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return myResolveTargetKinds.contains(kind);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -263,7 +241,7 @@ public class GroovyConstructorNamedArgumentProvider extends GroovyNamedArgumentP
|
||||
myNameHint = nameHint;
|
||||
}
|
||||
|
||||
public void setResolveTargetKinds(EnumSet<ResolveKind> resolveTargetKinds) {
|
||||
public void setResolveTargetKinds(EnumSet<DeclarationKind> resolveTargetKinds) {
|
||||
myResolveTargetKinds = resolveTargetKinds;
|
||||
}
|
||||
}
|
||||
|
||||
+5
-7
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,6 +20,7 @@ import com.intellij.lang.ASTNode;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.scope.ElementClassHint;
|
||||
import com.intellij.psi.scope.NameHint;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import com.intellij.psi.stubs.StubElement;
|
||||
@@ -53,7 +54,6 @@ import org.jetbrains.plugins.groovy.lang.psi.stubs.GrPackageDefinitionStub;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.MethodTypeInferencer;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.PackageSkippingProcessor;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint;
|
||||
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
@@ -127,7 +127,7 @@ public class GroovyFileImpl extends GroovyFileBaseImpl implements GroovyFile {
|
||||
@NotNull ResolveState state,
|
||||
@Nullable PsiElement lastParent,
|
||||
@NotNull PsiElement place) {
|
||||
ClassHint classHint = processor.getHint(ClassHint.KEY);
|
||||
ElementClassHint classHint = processor.getHint(ElementClassHint.KEY);
|
||||
|
||||
if (myContext != null) {
|
||||
if (ResolveUtil.shouldProcessProperties(classHint)) {
|
||||
@@ -225,9 +225,7 @@ public class GroovyFileImpl extends GroovyFileBaseImpl implements GroovyFile {
|
||||
final String name = nameHint.getName(state);
|
||||
if (name == null) return true;
|
||||
|
||||
final ClassHint classHint = processor.getHint(ClassHint.KEY);
|
||||
if (classHint != null && !classHint.shouldProcess(ClassHint.ResolveKind.PROPERTY)) return true;
|
||||
|
||||
if (!ResolveUtil.shouldProcessProperties(processor.getHint(ElementClassHint.KEY))) return true;
|
||||
|
||||
final ConcurrentMap<String, GrBindingVariable> bindings = getBindings();
|
||||
|
||||
@@ -257,7 +255,7 @@ public class GroovyFileImpl extends GroovyFileBaseImpl implements GroovyFile {
|
||||
@NotNull ResolveState state,
|
||||
@Nullable PsiElement lastParent,
|
||||
@NotNull PsiElement place) {
|
||||
if (ResolveUtil.shouldProcessClasses(processor.getHint(ClassHint.KEY))) {
|
||||
if (ResolveUtil.shouldProcessClasses(processor.getHint(ElementClassHint.KEY))) {
|
||||
PsiPackage aPackage = JavaPsiFacade.getInstance(getProject()).findPackage(getPackageName());
|
||||
if (aPackage != null) {
|
||||
return aPackage.processDeclarations(new PackageSkippingProcessor(processor), state, lastParent, place);
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,6 +16,7 @@
|
||||
package org.jetbrains.plugins.groovy.lang.psi.impl;
|
||||
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.scope.ElementClassHint;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -26,7 +27,6 @@ import org.jetbrains.plugins.groovy.lang.psi.api.toplevel.imports.GrImportStatem
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.DefaultImportContributor;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.PackageSkippingProcessor;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
|
||||
@@ -88,7 +88,7 @@ public class GroovyImportHelper {
|
||||
@Nullable PsiElement lastParent,
|
||||
@NotNull PsiElement place,
|
||||
@NotNull GroovyFile file) {
|
||||
if (!ResolveUtil.shouldProcessClasses(processor.getHint(ClassHint.KEY))) return true;
|
||||
if (!ResolveUtil.shouldProcessClasses(processor.getHint(ElementClassHint.KEY))) return true;
|
||||
|
||||
JavaPsiFacade facade = JavaPsiFacade.getInstance(file.getProject());
|
||||
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,6 +18,7 @@ package org.jetbrains.plugins.groovy.lang.psi.impl.statements;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.ResolveState;
|
||||
import com.intellij.psi.scope.ElementClassHint;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -30,7 +31,6 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.params.GrParameter;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.params.GrParameterList;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyPsiElementImpl;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint;
|
||||
|
||||
/**
|
||||
* @author ilyas
|
||||
@@ -62,7 +62,7 @@ public class GrCatchClauseImpl extends GroovyPsiElementImpl implements GrCatchCl
|
||||
|
||||
@Override
|
||||
public boolean processDeclarations(@NotNull PsiScopeProcessor processor, @NotNull ResolveState state, PsiElement lastParent, @NotNull PsiElement place) {
|
||||
if (!ResolveUtil.shouldProcessProperties(processor.getHint(ClassHint.KEY))) return true;
|
||||
if (!ResolveUtil.shouldProcessProperties(processor.getHint(ElementClassHint.KEY))) return true;
|
||||
|
||||
GrParameter parameter = getParameter();
|
||||
return parameter == null || ResolveUtil.processElement(processor, parameter, state);
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,6 +19,7 @@ package org.jetbrains.plugins.groovy.lang.psi.impl.statements;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.ResolveState;
|
||||
import com.intellij.psi.scope.ElementClassHint;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
@@ -35,7 +36,6 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.clauses.GrForInClaus
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyPsiElementImpl;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.PsiImplUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint;
|
||||
|
||||
/**
|
||||
* @autor: ilyas
|
||||
@@ -71,7 +71,7 @@ public class GrForStatementImpl extends GroovyPsiElementImpl implements GrForSta
|
||||
@NotNull ResolveState state,
|
||||
@Nullable PsiElement lastParent,
|
||||
@NotNull PsiElement place) {
|
||||
if (!ResolveUtil.shouldProcessProperties(processor.getHint(ClassHint.KEY))) return true;
|
||||
if (!ResolveUtil.shouldProcessProperties(processor.getHint(ElementClassHint.KEY))) return true;
|
||||
|
||||
GrForClause forClause = getClause();
|
||||
final GrVariable varScope = PsiTreeUtil.getParentOfType(place, GrVariable.class);
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,6 +20,7 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.codeStyle.JavaCodeStyleManager;
|
||||
import com.intellij.psi.scope.ElementClassHint;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import com.intellij.psi.stubs.EmptyStub;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
@@ -47,7 +48,6 @@ import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyPsiElementImpl;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.util.PsiUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -197,7 +197,7 @@ public class GrVariableDeclarationImpl extends GrStubElementBase<EmptyStub> impl
|
||||
@NotNull ResolveState state,
|
||||
@Nullable PsiElement lastParent,
|
||||
@NotNull PsiElement place) {
|
||||
if (!ResolveUtil.shouldProcessProperties(processor.getHint(ClassHint.KEY))) return true;
|
||||
if (!ResolveUtil.shouldProcessProperties(processor.getHint(ElementClassHint.KEY))) return true;
|
||||
|
||||
if (lastParent != null && !(getParent() instanceof GrTypeDefinitionBody) && lastParent == getTupleInitializer()) {
|
||||
return true;
|
||||
|
||||
+5
-8
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,6 +18,7 @@ package org.jetbrains.plugins.groovy.lang.psi.impl.statements.blocks;
|
||||
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.scope.ElementClassHint;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.util.CachedValueProvider;
|
||||
@@ -41,10 +42,7 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.params.GrParameter;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.params.GrParameterList;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefinition;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.dataFlow.types.TypeInferenceHelper;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.GrClosureType;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyPsiElementImpl;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyPsiManager;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.PsiImplUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.*;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.statements.params.GrParameterListImpl;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.ClosureSyntheticParameter;
|
||||
@@ -53,7 +51,6 @@ import org.jetbrains.plugins.groovy.lang.psi.util.GroovyCommonClassNames;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.MethodTypeInferencer;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyNamesUtil;
|
||||
|
||||
/**
|
||||
* @author ilyas
|
||||
@@ -98,7 +95,7 @@ public class GrClosableBlockImpl extends GrBlockImpl implements GrClosableBlock
|
||||
|
||||
if (!super.processDeclarations(processor, state, lastParent, place)) return false;
|
||||
if (!processParameters(processor, state, place)) return false;
|
||||
if (ResolveUtil.shouldProcessProperties(processor.getHint(ClassHint.KEY)) && !ResolveUtil.processElement(processor, getOwner(), state)) return false;
|
||||
if (ResolveUtil.shouldProcessProperties(processor.getHint(ElementClassHint.KEY)) && !ResolveUtil.processElement(processor, getOwner(), state)) return false;
|
||||
if (!processClosureClassMembers(processor, state, lastParent, place)) return false;
|
||||
|
||||
return true;
|
||||
@@ -171,7 +168,7 @@ public class GrClosableBlockImpl extends GrBlockImpl implements GrClosableBlock
|
||||
private boolean processParameters(@NotNull PsiScopeProcessor processor,
|
||||
@NotNull ResolveState state,
|
||||
@NotNull PsiElement place) {
|
||||
if (!ResolveUtil.shouldProcessProperties(processor.getHint(ClassHint.KEY))) return true;
|
||||
if (!ResolveUtil.shouldProcessProperties(processor.getHint(ElementClassHint.KEY))) return true;
|
||||
|
||||
if (hasParametersSection()) {
|
||||
for (GrParameter parameter : getParameters()) {
|
||||
|
||||
+2
-1
@@ -22,6 +22,7 @@ import com.intellij.openapi.util.*;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.source.resolve.ResolveCache;
|
||||
import com.intellij.psi.scope.ElementClassHint;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.util.InheritanceUtil;
|
||||
import com.intellij.psi.util.PropertyUtil;
|
||||
@@ -163,7 +164,7 @@ public class GrReferenceExpressionImpl extends GrReferenceElementImpl<GrExpressi
|
||||
}
|
||||
|
||||
|
||||
EnumSet<ClassHint.ResolveKind> kinds = getParent() instanceof GrReferenceExpression
|
||||
EnumSet<ElementClassHint.DeclarationKind> kinds = getParent() instanceof GrReferenceExpression
|
||||
? ClassHint.RESOLVE_KINDS_CLASS_PACKAGE
|
||||
: ClassHint.RESOLVE_KINDS_CLASS;
|
||||
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,6 +20,7 @@ import com.intellij.lang.ASTNode;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.PsiManagerEx;
|
||||
import com.intellij.psi.impl.light.LightMethodBuilder;
|
||||
import com.intellij.psi.scope.ElementClassHint;
|
||||
import com.intellij.psi.scope.NameHint;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import com.intellij.psi.util.CachedValueProvider;
|
||||
@@ -40,7 +41,6 @@ import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUt
|
||||
import org.jetbrains.plugins.groovy.lang.psi.stubs.GrTypeDefinitionStub;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.util.GroovyCommonClassNames;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint;
|
||||
|
||||
/**
|
||||
* @author Dmitry.Krasilschikov
|
||||
@@ -119,7 +119,7 @@ public class GrEnumTypeDefinitionImpl extends GrTypeDefinitionImpl implements Gr
|
||||
@NotNull ResolveState state,
|
||||
@Nullable PsiElement lastParent,
|
||||
@NotNull PsiElement place) {
|
||||
if (ResolveUtil.shouldProcessMethods(processor.getHint(ClassHint.KEY))) {
|
||||
if (ResolveUtil.shouldProcessMethods(processor.getHint(ElementClassHint.KEY))) {
|
||||
final NameHint nameHint = processor.getHint(NameHint.KEY);
|
||||
final String name = nameHint == null ? null : nameHint.getName(state);
|
||||
for (PsiMethod method : getDefEnumMethods()) {
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -24,6 +24,7 @@ import com.intellij.psi.impl.ElementPresentationUtil;
|
||||
import com.intellij.psi.impl.PsiClassImplUtil;
|
||||
import com.intellij.psi.impl.PsiSuperMethodImplUtil;
|
||||
import com.intellij.psi.presentation.java.JavaPresentationUtil;
|
||||
import com.intellij.psi.scope.ElementClassHint;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import com.intellij.psi.search.SearchScope;
|
||||
import com.intellij.psi.stubs.IStubElementType;
|
||||
@@ -71,7 +72,6 @@ import org.jetbrains.plugins.groovy.lang.psi.stubs.GrMethodStub;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.util.PsiUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.MethodTypeInferencer;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.Collections;
|
||||
@@ -171,7 +171,7 @@ public abstract class GrMethodBaseImpl extends GrStubElementBase<GrMethodStub> i
|
||||
@NotNull ResolveState state,
|
||||
@Nullable PsiElement lastParent,
|
||||
@NotNull PsiElement place) {
|
||||
ClassHint classHint = processor.getHint(ClassHint.KEY);
|
||||
ElementClassHint classHint = processor.getHint(ElementClassHint.KEY);
|
||||
|
||||
if (ResolveUtil.shouldProcessClasses(classHint)) {
|
||||
for (final GrTypeParameter typeParameter : getTypeParameters()) {
|
||||
|
||||
+7
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,6 +21,7 @@ import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.scope.DelegatingScopeProcessor;
|
||||
import com.intellij.psi.scope.ElementClassHint;
|
||||
import com.intellij.psi.scope.NameHint;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import com.intellij.psi.stubs.IStubElementType;
|
||||
@@ -46,6 +47,8 @@ import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.processors.GrDelegatingScopeProcessorWithHints;
|
||||
|
||||
import static org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint.RESOLVE_KINDS_METHOD;
|
||||
|
||||
/**
|
||||
* @author ilyas
|
||||
*/
|
||||
@@ -160,7 +163,7 @@ public class GrImportStatementImpl extends GrStubElementBase<GrImportStatementSt
|
||||
}
|
||||
}
|
||||
|
||||
if (ResolveUtil.shouldProcessMethods(processor.getHint(ClassHint.KEY))) {
|
||||
if (ResolveUtil.shouldProcessMethods(processor.getHint(ElementClassHint.KEY))) {
|
||||
if (hintName == null || importedName.equals(GroovyPropertyUtils.getPropertyNameByGetterName(hintName, true))) {
|
||||
if (!clazz.processDeclarations(new StaticGetterProcessor(refName, processor), state, lastParent, place)) {
|
||||
return false;
|
||||
@@ -178,7 +181,7 @@ public class GrImportStatementImpl extends GrStubElementBase<GrImportStatementSt
|
||||
}
|
||||
|
||||
private boolean processSingleClassImport(@NotNull PsiScopeProcessor processor, @NotNull ResolveState state) {
|
||||
if (!ResolveUtil.shouldProcessClasses(processor.getHint(ClassHint.KEY))) return true;
|
||||
if (!ResolveUtil.shouldProcessClasses(processor.getHint(ElementClassHint.KEY))) return true;
|
||||
|
||||
GrCodeReferenceElement ref = getImportReference();
|
||||
if (ref == null) return true;
|
||||
@@ -226,7 +229,7 @@ public class GrImportStatementImpl extends GrStubElementBase<GrImportStatementSt
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (ResolveUtil.shouldProcessClasses(processor.getHint(ClassHint.KEY))) {
|
||||
if (ResolveUtil.shouldProcessClasses(processor.getHint(ElementClassHint.KEY))) {
|
||||
String qName = PsiUtil.getQualifiedReferenceText(ref);
|
||||
if (qName != null) {
|
||||
PsiPackage aPackage = JavaPsiFacade.getInstance(getProject()).findPackage(qName);
|
||||
|
||||
+3
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,6 +21,7 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.source.resolve.ResolveCache;
|
||||
import com.intellij.psi.scope.ElementClassHint;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
@@ -331,7 +332,7 @@ public class GrCodeReferenceElementImpl extends GrReferenceElementImpl<GrCodeRef
|
||||
break;
|
||||
|
||||
case CLASS: {
|
||||
EnumSet<ClassHint.ResolveKind> kinds = ClassHint.RESOLVE_KINDS_CLASS;
|
||||
EnumSet<ElementClassHint.DeclarationKind> kinds = ClassHint.RESOLVE_KINDS_CLASS;
|
||||
ResolverProcessor processor = new ClassResolverProcessor(refName, ref, kinds);
|
||||
GrCodeReferenceElement qualifier = ref.getQualifier();
|
||||
if (qualifier != null) {
|
||||
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -23,6 +23,7 @@ import com.intellij.openapi.util.RecursionManager;
|
||||
import com.intellij.openapi.util.Trinity;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.scope.DelegatingScopeProcessor;
|
||||
import com.intellij.psi.scope.ElementClassHint;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.util.*;
|
||||
@@ -90,9 +91,8 @@ public class GdkMethodUtil {
|
||||
}
|
||||
|
||||
public static boolean categoryIteration(GrClosableBlock place, final PsiScopeProcessor processor, ResolveState state) {
|
||||
final ClassHint classHint = processor.getHint(ClassHint.KEY);
|
||||
if (classHint != null && !classHint.shouldProcess(ClassHint.ResolveKind.METHOD)) return true;
|
||||
|
||||
if (!ResolveUtil.shouldProcessMethods(processor.getHint(ElementClassHint.KEY))) return true;
|
||||
|
||||
final GrMethodCall call = checkMethodCall(place, USE);
|
||||
if (call == null) return true;
|
||||
|
||||
|
||||
+2
-2
@@ -25,6 +25,7 @@ import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.PsiClassImplUtil;
|
||||
import com.intellij.psi.infos.CandidateInfo;
|
||||
import com.intellij.psi.scope.ElementClassHint;
|
||||
import com.intellij.psi.scope.NameHint;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import com.intellij.psi.util.*;
|
||||
@@ -59,7 +60,6 @@ import org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.GrScriptField;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.CollectClassMembersUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.ast.AstTransformContributor;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -254,7 +254,7 @@ public class GrClassImplUtil {
|
||||
|
||||
NameHint nameHint = processor.getHint(NameHint.KEY);
|
||||
String name = nameHint == null ? null : nameHint.getName(state);
|
||||
ClassHint classHint = processor.getHint(ClassHint.KEY);
|
||||
ElementClassHint classHint = processor.getHint(ElementClassHint.KEY);
|
||||
final PsiSubstitutor substitutor = state.get(PsiSubstitutor.KEY);
|
||||
final PsiElementFactory factory = JavaPsiFacade.getElementFactory(place.getProject());
|
||||
|
||||
|
||||
+7
-6
@@ -19,6 +19,8 @@ import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.ResolveState;
|
||||
import com.intellij.psi.scope.ElementClassHint;
|
||||
import com.intellij.psi.scope.ElementClassHint.DeclarationKind;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import com.intellij.psi.util.CachedValueProvider;
|
||||
import com.intellij.psi.util.CachedValuesManager;
|
||||
@@ -29,7 +31,6 @@ import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.blocks.GrClosableBlock;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.processors.GrScopeProcessorWithHints;
|
||||
|
||||
import java.util.EnumSet;
|
||||
@@ -50,20 +51,20 @@ class DeclarationCacheKey {
|
||||
}
|
||||
};
|
||||
@Nullable private final String name;
|
||||
@NotNull private final EnumSet<ClassHint.ResolveKind> kinds;
|
||||
@NotNull private final EnumSet<DeclarationKind> kinds;
|
||||
private final boolean nonCode;
|
||||
@NotNull private final PsiElement place;
|
||||
|
||||
DeclarationCacheKey(@Nullable String name, ClassHint hint, boolean nonCode, @NotNull PsiElement place) {
|
||||
DeclarationCacheKey(@Nullable String name, ElementClassHint hint, boolean nonCode, @NotNull PsiElement place) {
|
||||
this.name = name;
|
||||
this.kinds = getResolveKinds(hint);
|
||||
this.nonCode = nonCode;
|
||||
this.place = place;
|
||||
}
|
||||
|
||||
private static EnumSet<ClassHint.ResolveKind> getResolveKinds(ClassHint hint) {
|
||||
EnumSet<ClassHint.ResolveKind> set = EnumSet.noneOf(ClassHint.ResolveKind.class);
|
||||
for (ClassHint.ResolveKind kind : ClassHint.ResolveKind.values()) {
|
||||
private static EnumSet<DeclarationKind> getResolveKinds(ElementClassHint hint) {
|
||||
EnumSet<DeclarationKind> set = EnumSet.noneOf(DeclarationKind.class);
|
||||
for (DeclarationKind kind : DeclarationKind.values()) {
|
||||
if (hint.shouldProcess(kind)) {
|
||||
set.add(kind);
|
||||
}
|
||||
|
||||
+3
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,6 +18,7 @@ package org.jetbrains.plugins.groovy.lang.resolve;
|
||||
import com.intellij.openapi.util.VolatileNotNullLazyValue;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.ResolveState;
|
||||
import com.intellij.psi.scope.ElementClassHint;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -61,6 +62,7 @@ public class GdkMethodDslProvider implements GdslMembersProvider {
|
||||
|
||||
@Override
|
||||
public boolean processMembers(GroovyClassDescriptor descriptor, PsiScopeProcessor processor, ResolveState state) {
|
||||
if (!ResolveUtil.shouldProcessMethods(processor.getHint(ElementClassHint.KEY))) return true;
|
||||
return methodsMap.getValue().processMethods(processor, state, descriptor.getPsiType(), descriptor.getProject());
|
||||
}
|
||||
});
|
||||
|
||||
+3
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,6 +18,8 @@ package org.jetbrains.plugins.groovy.lang.resolve;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.processors.GrDelegatingScopeProcessorWithHints;
|
||||
|
||||
import static org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint.RESOLVE_KINDS_CLASS;
|
||||
|
||||
/**
|
||||
* Created by Max Medvedev on 27/03/14
|
||||
*/
|
||||
|
||||
+16
-11
@@ -22,6 +22,8 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.scope.ElementClassHint;
|
||||
import com.intellij.psi.scope.ElementClassHint.DeclarationKind;
|
||||
import com.intellij.psi.scope.JavaScopeProcessorEvent;
|
||||
import com.intellij.psi.scope.NameHint;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
@@ -73,6 +75,8 @@ import org.jetbrains.plugins.groovy.lang.resolve.processors.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint.RESOLVE_CONTEXT;
|
||||
|
||||
/**
|
||||
* @author ven
|
||||
*/
|
||||
@@ -111,7 +115,7 @@ public class ResolveUtil {
|
||||
boolean processNonCodeMethods,
|
||||
@NotNull final ResolveState state) {
|
||||
try {
|
||||
ClassHint hint = processor.getHint(ClassHint.KEY);
|
||||
ElementClassHint hint = processor.getHint(ElementClassHint.KEY);
|
||||
if (hint != null) {
|
||||
return new DeclarationCacheKey(getNameHint(processor), hint, processNonCodeMethods, originalPlace).processCachedDeclarations(place, processor);
|
||||
}
|
||||
@@ -239,7 +243,7 @@ public class ResolveUtil {
|
||||
@NotNull ResolveState state,
|
||||
@Nullable PsiElement lastParent,
|
||||
@NotNull PsiElement place) {
|
||||
if (!shouldProcessProperties(processor.getHint(ClassHint.KEY))) return true;
|
||||
if (!shouldProcessProperties(processor.getHint(ElementClassHint.KEY))) return true;
|
||||
|
||||
PsiElement run = lastParent == null ? element.getLastChild() : lastParent.getPrevSibling();
|
||||
while (run != null) {
|
||||
@@ -940,27 +944,28 @@ public class ResolveUtil {
|
||||
return expectedParams;
|
||||
}
|
||||
|
||||
public static boolean shouldProcessClasses(ClassHint classHint) {
|
||||
return classHint == null || classHint.shouldProcess(ClassHint.ResolveKind.CLASS);
|
||||
public static boolean shouldProcessClasses(ElementClassHint classHint) {
|
||||
return classHint == null || classHint.shouldProcess(DeclarationKind.CLASS);
|
||||
}
|
||||
|
||||
public static boolean shouldProcessMethods(ClassHint classHint) {
|
||||
return classHint == null || classHint.shouldProcess(ClassHint.ResolveKind.METHOD);
|
||||
public static boolean shouldProcessMethods(ElementClassHint classHint) {
|
||||
return classHint == null || classHint.shouldProcess(DeclarationKind.METHOD);
|
||||
}
|
||||
|
||||
public static boolean shouldProcessProperties(ClassHint classHint) {
|
||||
return classHint == null || classHint.shouldProcess(ClassHint.ResolveKind.PROPERTY);
|
||||
public static boolean shouldProcessProperties(ElementClassHint classHint) {
|
||||
return classHint == null || classHint.shouldProcess(DeclarationKind.VARIABLE)
|
||||
|| classHint.shouldProcess(DeclarationKind.FIELD) || classHint.shouldProcess(DeclarationKind.ENUM_CONST);
|
||||
}
|
||||
|
||||
public static boolean shouldProcessPackages(ClassHint classHint) {
|
||||
return classHint == null || classHint.shouldProcess(ClassHint.ResolveKind.PACKAGE);
|
||||
public static boolean shouldProcessPackages(ElementClassHint classHint) {
|
||||
return classHint == null || classHint.shouldProcess(DeclarationKind.PACKAGE);
|
||||
}
|
||||
|
||||
public static boolean processStaticImports(@NotNull PsiScopeProcessor resolver,
|
||||
@NotNull PsiFile file,
|
||||
@NotNull ResolveState state,
|
||||
@NotNull PsiElement place) {
|
||||
if (!shouldProcessMethods(resolver.getHint(ClassHint.KEY))) return true;
|
||||
if (!shouldProcessMethods(resolver.getHint(ElementClassHint.KEY))) return true;
|
||||
|
||||
return file.processDeclarations(new GrDelegatingScopeProcessorWithHints(resolver, null, ClassHint.RESOLVE_KINDS_METHOD) {
|
||||
@Override
|
||||
|
||||
+3
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -24,6 +24,8 @@ import org.jetbrains.plugins.groovy.lang.resolve.NonCodeMembersContributor;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.processors.GrDelegatingScopeProcessorWithHints;
|
||||
|
||||
import static org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint.RESOLVE_KINDS_PROPERTY;
|
||||
|
||||
/**
|
||||
* @author Maxim.Medvedev
|
||||
*/
|
||||
|
||||
+3
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -25,6 +25,8 @@ import org.jetbrains.plugins.groovy.lang.psi.api.toplevel.imports.GrImportStatem
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyResolveResultImpl;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.util.GroovyPropertyUtils;
|
||||
|
||||
import static org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint.RESOLVE_CONTEXT;
|
||||
|
||||
/**
|
||||
* @author Maxim.Medvedev
|
||||
*/
|
||||
|
||||
+9
-16
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,27 +18,20 @@ package org.jetbrains.plugins.groovy.lang.resolve.processors;
|
||||
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.scope.ElementClassHint.DeclarationKind;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import static com.intellij.psi.scope.ElementClassHint.DeclarationKind.*;
|
||||
|
||||
/**
|
||||
* @author ven
|
||||
*/
|
||||
public interface ClassHint {
|
||||
Key<ClassHint> KEY = Key.create("ClassHint");
|
||||
Key<PsiElement> RESOLVE_CONTEXT = Key.create("RESOLVE_CONTEXT");
|
||||
EnumSet<ResolveKind> RESOLVE_KINDS_CLASS_PACKAGE = EnumSet.of(ResolveKind.CLASS, ResolveKind.PACKAGE);
|
||||
EnumSet<ResolveKind> RESOLVE_KINDS_CLASS = EnumSet.of(ResolveKind.CLASS);
|
||||
EnumSet<ResolveKind> RESOLVE_KINDS_METHOD = EnumSet.of(ResolveKind.METHOD);
|
||||
EnumSet<ResolveKind> RESOLVE_KINDS_METHOD_PROPERTY = EnumSet.of(ResolveKind.METHOD, ResolveKind.PROPERTY);
|
||||
EnumSet<ResolveKind> RESOLVE_KINDS_PROPERTY = EnumSet.of(ResolveKind.PROPERTY);
|
||||
|
||||
enum ResolveKind {
|
||||
CLASS,
|
||||
PACKAGE,
|
||||
METHOD,
|
||||
PROPERTY
|
||||
}
|
||||
|
||||
boolean shouldProcess(ResolveKind resolveKind);
|
||||
EnumSet<DeclarationKind> RESOLVE_KINDS_CLASS_PACKAGE = EnumSet.of(CLASS, PACKAGE);
|
||||
EnumSet<DeclarationKind> RESOLVE_KINDS_CLASS = EnumSet.of(CLASS);
|
||||
EnumSet<DeclarationKind> RESOLVE_KINDS_METHOD = EnumSet.of(METHOD);
|
||||
EnumSet<DeclarationKind> RESOLVE_KINDS_PROPERTY = EnumSet.of(VARIABLE, FIELD, ENUM_CONST);
|
||||
EnumSet<DeclarationKind> RESOLVE_KINDS_METHOD_PROPERTY = EnumSet.of(METHOD, VARIABLE, FIELD, ENUM_CONST);
|
||||
}
|
||||
|
||||
+4
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,11 +21,13 @@ import org.jetbrains.plugins.groovy.lang.psi.GrReferenceElement;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import static org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint.RESOLVE_KINDS_CLASS;
|
||||
|
||||
/**
|
||||
* @author ven
|
||||
*/
|
||||
public class ClassResolverProcessor extends ResolverProcessor {
|
||||
public ClassResolverProcessor(String refName, GrReferenceElement ref, EnumSet<ResolveKind> kinds) {
|
||||
public ClassResolverProcessor(String refName, GrReferenceElement ref, EnumSet<DeclarationKind> kinds) {
|
||||
super(refName, kinds, ref, ref.getTypeArguments());
|
||||
}
|
||||
|
||||
|
||||
+5
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -26,11 +26,14 @@ import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import static org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint.RESOLVE_KINDS_CLASS_PACKAGE;
|
||||
import static org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint.RESOLVE_KINDS_METHOD_PROPERTY;
|
||||
|
||||
/**
|
||||
* @author ven
|
||||
*/
|
||||
public class CompletionProcessor extends ResolverProcessor {
|
||||
private CompletionProcessor(PsiElement place, final EnumSet<ResolveKind> resolveTargets, final String name) {
|
||||
private CompletionProcessor(PsiElement place, final EnumSet<DeclarationKind> resolveTargets, final String name) {
|
||||
super(name, resolveTargets, place, PsiType.EMPTY_ARRAY);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -32,7 +32,7 @@ public class GrDelegatingScopeProcessorWithHints extends GrScopeProcessorWithHin
|
||||
|
||||
public GrDelegatingScopeProcessorWithHints(@NotNull PsiScopeProcessor delegate,
|
||||
@Nullable String name,
|
||||
@Nullable EnumSet<ResolveKind> resolveTargets) {
|
||||
@Nullable EnumSet<DeclarationKind> resolveTargets) {
|
||||
super(name, resolveTargets);
|
||||
myDelegate = delegate;
|
||||
}
|
||||
|
||||
+6
-27
@@ -28,12 +28,12 @@ import java.util.EnumSet;
|
||||
/**
|
||||
* Created by Max Medvedev on 31/03/14
|
||||
*/
|
||||
public abstract class GrScopeProcessorWithHints implements PsiScopeProcessor, NameHint, ClassHint, ElementClassHint {
|
||||
protected final @Nullable EnumSet<ResolveKind> myResolveTargetKinds;
|
||||
public abstract class GrScopeProcessorWithHints implements PsiScopeProcessor, NameHint, ElementClassHint {
|
||||
protected final @Nullable EnumSet<DeclarationKind> myResolveTargetKinds;
|
||||
protected final @Nullable String myName;
|
||||
|
||||
public GrScopeProcessorWithHints(@Nullable String name,
|
||||
@Nullable EnumSet<ResolveKind> resolveTargets) {
|
||||
@Nullable EnumSet<DeclarationKind> resolveTargets) {
|
||||
myName = name;
|
||||
myResolveTargetKinds = resolveTargets;
|
||||
}
|
||||
@@ -45,38 +45,17 @@ public abstract class GrScopeProcessorWithHints implements PsiScopeProcessor, Na
|
||||
return (T)this;
|
||||
}
|
||||
|
||||
if ((ClassHint.KEY == hintKey || ElementClassHint.KEY == hintKey) && myResolveTargetKinds != null) {
|
||||
if (ElementClassHint.KEY == hintKey && myResolveTargetKinds != null) {
|
||||
return (T)this;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldProcess(@NotNull ResolveKind resolveKind) {
|
||||
assert myResolveTargetKinds != null : "don't invoke shouldProcess if resolveTargets are not declared";
|
||||
return myResolveTargetKinds.contains(resolveKind);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldProcess(DeclarationKind kind) {
|
||||
switch (kind) {
|
||||
case CLASS:
|
||||
return shouldProcess(ResolveKind.CLASS);
|
||||
|
||||
case ENUM_CONST:
|
||||
case VARIABLE:
|
||||
case FIELD:
|
||||
return shouldProcess(ResolveKind.PROPERTY);
|
||||
|
||||
case METHOD:
|
||||
return shouldProcess(ResolveKind.METHOD);
|
||||
|
||||
case PACKAGE:
|
||||
return shouldProcess(ResolveKind.PACKAGE);
|
||||
}
|
||||
|
||||
return false;
|
||||
assert myResolveTargetKinds != null : "don't invoke shouldProcess if resolveTargets are not declared";
|
||||
return myResolveTargetKinds.contains(kind);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+4
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -38,6 +38,9 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint.RESOLVE_CONTEXT;
|
||||
import static org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint.RESOLVE_KINDS_METHOD_PROPERTY;
|
||||
|
||||
/**
|
||||
* @author ven
|
||||
*/
|
||||
|
||||
+3
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -26,6 +26,8 @@ import org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.GrBindingVariable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint.RESOLVE_KINDS_PROPERTY;
|
||||
|
||||
/**
|
||||
* @author ven
|
||||
*/
|
||||
|
||||
+12
-9
@@ -32,6 +32,8 @@ import org.jetbrains.plugins.groovy.lang.psi.util.PsiUtil;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint.RESOLVE_CONTEXT;
|
||||
|
||||
/**
|
||||
* @author ven
|
||||
*/
|
||||
@@ -44,7 +46,7 @@ public class ResolverProcessor extends GrScopeProcessorWithHints {
|
||||
private List<GroovyResolveResult> myCandidates;
|
||||
|
||||
protected ResolverProcessor(@Nullable String name,
|
||||
@NotNull EnumSet<ResolveKind> resolveTargets,
|
||||
@NotNull EnumSet<DeclarationKind> resolveTargets,
|
||||
@NotNull PsiElement place,
|
||||
@NotNull PsiType[] typeArguments) {
|
||||
super(name, resolveTargets);
|
||||
@@ -58,7 +60,7 @@ public class ResolverProcessor extends GrScopeProcessorWithHints {
|
||||
return true; // the debugger creates a Java code block context and our expressions to evaluate resolve there
|
||||
}
|
||||
|
||||
if (myResolveTargetKinds == null || myResolveTargetKinds.contains(getResolveKind(element))) {
|
||||
if (myResolveTargetKinds == null || myResolveTargetKinds.contains(getDeclarationKind(element))) {
|
||||
//hack for resolve of java local vars and parameters
|
||||
//don't check field for name because they can be aliased imported
|
||||
if (element instanceof PsiVariable && !(element instanceof PsiField) &&
|
||||
@@ -105,7 +107,7 @@ public class ResolverProcessor extends GrScopeProcessorWithHints {
|
||||
String text;
|
||||
if (element instanceof LightElement) {
|
||||
final PsiElement context = element.getContext();
|
||||
text = context instanceof LightElement ? context.toString() :
|
||||
text = context instanceof LightElement ? context.toString() :
|
||||
context != null ? context.getText() : null;
|
||||
}
|
||||
else {
|
||||
@@ -166,12 +168,13 @@ public class ResolverProcessor extends GrScopeProcessorWithHints {
|
||||
return myCandidates != null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static ResolveKind getResolveKind(PsiElement element) {
|
||||
if (element instanceof PsiVariable) return ResolveKind.PROPERTY;
|
||||
if (element instanceof PsiMethod) return ResolveKind.METHOD;
|
||||
if (element instanceof PsiPackage) return ResolveKind.PACKAGE;
|
||||
if (element instanceof PsiClass) return ResolveKind.CLASS;
|
||||
private static DeclarationKind getDeclarationKind(PsiElement element) {
|
||||
if (element instanceof PsiMethod) return DeclarationKind.METHOD;
|
||||
if (element instanceof PsiEnumConstant) return DeclarationKind.ENUM_CONST;
|
||||
if (element instanceof PsiField) return DeclarationKind.FIELD;
|
||||
if (element instanceof PsiVariable) return DeclarationKind.VARIABLE;
|
||||
if (element instanceof PsiClass) return DeclarationKind.CLASS;
|
||||
if (element instanceof PsiPackage) return DeclarationKind.PACKAGE;
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
+3
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,13 +16,13 @@
|
||||
package org.jetbrains.plugins.groovy.markup;
|
||||
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.scope.ElementClassHint;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.GrLightMethodBuilder;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.NonCodeMembersContributor;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint;
|
||||
|
||||
/**
|
||||
* @author Sergey Evdokimov
|
||||
@@ -45,8 +45,7 @@ public class XmlMarkupBuilderNonCodeMemberContributor extends NonCodeMembersCont
|
||||
|
||||
if (nameHint == null) return;
|
||||
|
||||
ClassHint classHint = processor.getHint(ClassHint.KEY);
|
||||
if (classHint != null && !classHint.shouldProcess(ClassHint.ResolveKind.METHOD)) return;
|
||||
if (!ResolveUtil.shouldProcessMethods(processor.getHint(ElementClassHint.KEY))) return;
|
||||
|
||||
GrLightMethodBuilder res = new GrLightMethodBuilder(aClass.getManager(), nameHint);
|
||||
res.addParameter("attrs", CommonClassNames.JAVA_UTIL_MAP, false);
|
||||
|
||||
+5
-5
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,6 +19,7 @@ import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiType;
|
||||
import com.intellij.psi.ResolveState;
|
||||
import com.intellij.psi.scope.ElementClassHint;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -26,7 +27,6 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMe
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.GrLightMethodBuilder;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.NonCodeMembersContributor;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -41,8 +41,8 @@ public class SpockMemberContributor extends NonCodeMembersContributor {
|
||||
@NotNull PsiScopeProcessor processor,
|
||||
@NotNull PsiElement place,
|
||||
@NotNull ResolveState state) {
|
||||
ClassHint classHint = processor.getHint(ClassHint.KEY);
|
||||
if (classHint == null || classHint.shouldProcess(ClassHint.ResolveKind.PROPERTY)) {
|
||||
ElementClassHint classHint = processor.getHint(ElementClassHint.KEY);
|
||||
if (ResolveUtil.shouldProcessProperties(classHint)) {
|
||||
GrMethod method = PsiTreeUtil.getParentOfType(place, GrMethod.class);
|
||||
if (method == null) return;
|
||||
|
||||
@@ -64,7 +64,7 @@ public class SpockMemberContributor extends NonCodeMembersContributor {
|
||||
}
|
||||
}
|
||||
|
||||
if (classHint == null || classHint.shouldProcess(ClassHint.ResolveKind.METHOD)) {
|
||||
if (ResolveUtil.shouldProcessMethods(classHint)) {
|
||||
if ("get_".equals(ResolveUtil.getNameHint(processor))) {
|
||||
GrLightMethodBuilder m = new GrLightMethodBuilder(aClass.getManager(), "get_");
|
||||
m.setReturnType(null);
|
||||
|
||||
+3
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,6 +19,7 @@ import com.google.common.collect.ImmutableMap;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.UserDataHolderEx;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.scope.ElementClassHint;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
@@ -32,7 +33,6 @@ import org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.GrMethodWrapper;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.util.GroovyCommonClassNames;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.NonCodeMembersContributor;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
@@ -834,8 +834,7 @@ public class SwingBuilderNonCodeMemberContributor extends NonCodeMembersContribu
|
||||
@NotNull PsiScopeProcessor processor,
|
||||
@NotNull PsiElement place,
|
||||
@NotNull ResolveState state) {
|
||||
ClassHint classHint = processor.getHint(ClassHint.KEY);
|
||||
if (classHint != null && !classHint.shouldProcess(ClassHint.ResolveKind.METHOD)) return;
|
||||
if (!ResolveUtil.shouldProcessMethods(processor.getHint(ElementClassHint.KEY))) return;
|
||||
|
||||
MultiMap<String, PsiMethod> methodMap = aClass.getUserData(KEY);
|
||||
if (methodMap == null) {
|
||||
|
||||
+5
-5
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,6 +19,7 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.UserDataHolderEx;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.scope.ElementClassHint;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import com.intellij.util.containers.MultiMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -37,7 +38,6 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrRe
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.GrLightMethodBuilder;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.util.GrStaticChecker;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.*;
|
||||
@@ -81,19 +81,19 @@ public class DynamicMemberUtils {
|
||||
}
|
||||
|
||||
public static boolean process(PsiScopeProcessor processor, boolean isInStaticContext, PsiElement place, String classSource) {
|
||||
ClassHint classHint = processor.getHint(ClassHint.KEY);
|
||||
ElementClassHint classHint = processor.getHint(ElementClassHint.KEY);
|
||||
String name = ResolveUtil.getNameHint(processor);
|
||||
|
||||
ClassMemberHolder memberHolder = getMembers(place.getProject(), classSource);
|
||||
|
||||
if (classHint == null || classHint.shouldProcess(ClassHint.ResolveKind.METHOD)) {
|
||||
if (ResolveUtil.shouldProcessMethods(classHint)) {
|
||||
PsiMethod[] methods = isInStaticContext ? memberHolder.getStaticMethods(name) : memberHolder.getMethods(name);
|
||||
for (PsiMethod method : methods) {
|
||||
if (!processor.execute(method, ResolveState.initial())) return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (classHint == null || classHint.shouldProcess(ClassHint.ResolveKind.PROPERTY)) {
|
||||
if (ResolveUtil.shouldProcessProperties(classHint)) {
|
||||
PsiField[] fields = isInStaticContext ? memberHolder.getStaticFields(name) : memberHolder.getFields(name);
|
||||
for (PsiField field : fields) {
|
||||
if (!processor.execute(field, ResolveState.initial())) return false;
|
||||
|
||||
+3
-1
@@ -66,6 +66,8 @@ import org.jetbrains.plugins.groovy.lang.resolve.processors.SubstitutorComputer;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint.RESOLVE_CONTEXT;
|
||||
|
||||
/**
|
||||
* @author ven
|
||||
*/
|
||||
@@ -404,7 +406,7 @@ public class CompleteReferenceExpression {
|
||||
private boolean myIsEmpty = true;
|
||||
|
||||
protected CompleteReferenceProcessor() {
|
||||
super(null, EnumSet.allOf(ResolveKind.class), myRefExpr, PsiType.EMPTY_ARRAY);
|
||||
super(null, EnumSet.allOf(DeclarationKind.class), myRefExpr, PsiType.EMPTY_ARRAY);
|
||||
myConsumer = new Consumer<LookupElement>() {
|
||||
@Override
|
||||
public void consume(LookupElement element) {
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.jetbrains.plugins.groovy.shell;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.source.PsiImmediateClassType;
|
||||
import com.intellij.psi.scope.ElementClassHint;
|
||||
import com.intellij.psi.scope.NameHint;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import com.intellij.testFramework.LightVirtualFile;
|
||||
@@ -28,7 +29,7 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpres
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefinition;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.GrClassReferenceType;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.GrLightVariable;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -89,10 +90,9 @@ public class GroovyShellCodeFragment extends GroovyCodeFragment {
|
||||
}
|
||||
|
||||
private boolean processVariables(@NotNull PsiScopeProcessor processor, @NotNull ResolveState state) {
|
||||
ClassHint classHint = processor.getHint(ClassHint.KEY);
|
||||
if (classHint != null &&
|
||||
!classHint.shouldProcess(ClassHint.ResolveKind.METHOD) &&
|
||||
!classHint.shouldProcess(ClassHint.ResolveKind.PROPERTY)) {
|
||||
ElementClassHint classHint = processor.getHint(ElementClassHint.KEY);
|
||||
if (!ResolveUtil.shouldProcessMethods(classHint) &&
|
||||
!ResolveUtil.shouldProcessProperties(classHint)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -119,8 +119,8 @@ public class GroovyShellCodeFragment extends GroovyCodeFragment {
|
||||
}
|
||||
|
||||
private boolean processTypeDefinitions(@NotNull PsiScopeProcessor processor, @NotNull ResolveState state) {
|
||||
ClassHint classHint = processor.getHint(ClassHint.KEY);
|
||||
if (classHint != null && !classHint.shouldProcess(ClassHint.ResolveKind.CLASS)) {
|
||||
ElementClassHint classHint = processor.getHint(ElementClassHint.KEY);
|
||||
if (!ResolveUtil.shouldProcessClasses(classHint)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user