mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[groovy] implement GroovyPolyVariantReference in PSI
This commit is contained in:
+4
-14
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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,18 +16,17 @@
|
||||
package org.jetbrains.plugins.groovy.lang.psi;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiPolyVariantReference;
|
||||
import com.intellij.psi.PsiType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.GroovyResolveResult;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.GroovyPolyVariantReference;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.types.GrTypeArgumentList;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.PsiImplUtil;
|
||||
|
||||
/**
|
||||
* @author ven
|
||||
*/
|
||||
public interface GrReferenceElement<Q extends PsiElement> extends GroovyPsiElement, PsiPolyVariantReference, GrQualifiedReference<Q> {
|
||||
public interface GrReferenceElement<Q extends PsiElement> extends GroovyPsiElement, GroovyPolyVariantReference, GrQualifiedReference<Q> {
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
String getReferenceName();
|
||||
@@ -38,15 +37,6 @@ public interface GrReferenceElement<Q extends PsiElement> extends GroovyPsiEleme
|
||||
return advancedResolve().getElement();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
default GroovyResolveResult advancedResolve() {
|
||||
return PsiImplUtil.extractUniqueResult(multiResolve(false));
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
GroovyResolveResult[] multiResolve(boolean incompleteCode);
|
||||
|
||||
@NotNull
|
||||
PsiType[] getTypeArguments();
|
||||
|
||||
|
||||
+7
-2
@@ -13,11 +13,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jetbrains.plugins.groovy.lang.resolve;
|
||||
package org.jetbrains.plugins.groovy.lang.psi.api;
|
||||
|
||||
import com.intellij.psi.PsiPolyVariantReference;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.GroovyResolveResult;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.PsiImplUtil;
|
||||
|
||||
/**
|
||||
* Same as {@link PsiPolyVariantReference} but returns {@link GroovyResolveResult}.
|
||||
@@ -29,4 +29,9 @@ public interface GroovyPolyVariantReference extends PsiPolyVariantReference {
|
||||
@NotNull
|
||||
@Override
|
||||
GroovyResolveResult[] multiResolve(boolean incompleteCode);
|
||||
|
||||
@NotNull
|
||||
default GroovyResolveResult advancedResolve() {
|
||||
return PsiImplUtil.extractUniqueResult(multiResolve(false));
|
||||
}
|
||||
}
|
||||
+5
-13
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -17,30 +17,29 @@
|
||||
package org.jetbrains.plugins.groovy.lang.psi.api.statements.arguments;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiPolyVariantReference;
|
||||
import com.intellij.psi.PsiType;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElement;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.GroovyResolveResult;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.GroovyPolyVariantReference;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpression;
|
||||
|
||||
/**
|
||||
* @author ilyas
|
||||
*/
|
||||
public interface GrArgumentLabel extends GroovyPsiElement, PsiPolyVariantReference {
|
||||
public interface GrArgumentLabel extends GroovyPsiElement, GroovyPolyVariantReference {
|
||||
|
||||
GrArgumentLabel[] EMPTY_ARRAY = new GrArgumentLabel[0];
|
||||
|
||||
@NotNull
|
||||
PsiElement getNameElement();
|
||||
|
||||
@Nullable
|
||||
/**
|
||||
* returns expression which is put into parentheses.
|
||||
* @return expression which is put into parentheses.
|
||||
*/
|
||||
@Nullable
|
||||
GrExpression getExpression();
|
||||
|
||||
@Nullable
|
||||
@@ -55,11 +54,4 @@ public interface GrArgumentLabel extends GroovyPsiElement, PsiPolyVariantReferen
|
||||
PsiType getLabelType();
|
||||
|
||||
GrNamedArgument getNamedArgument();
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
GroovyResolveResult[] multiResolve(boolean incomplete);
|
||||
|
||||
@NotNull
|
||||
GroovyResolveResult advancedResolve();
|
||||
}
|
||||
|
||||
+3
-7
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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,14 +16,13 @@
|
||||
package org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiPolyVariantReference;
|
||||
import com.intellij.psi.PsiType;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.GroovyResolveResult;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.GroovyPolyVariantReference;
|
||||
|
||||
public interface GrOperatorExpression extends GrExpression, PsiPolyVariantReference {
|
||||
public interface GrOperatorExpression extends GrExpression, GroovyPolyVariantReference {
|
||||
|
||||
@Nullable
|
||||
PsiType getLeftType();
|
||||
@@ -36,7 +35,4 @@ public interface GrOperatorExpression extends GrExpression, PsiPolyVariantRefere
|
||||
|
||||
@NotNull
|
||||
IElementType getOperationTokenType();
|
||||
|
||||
@NotNull
|
||||
GroovyResolveResult[] multiResolve(final boolean incompleteCode);
|
||||
}
|
||||
|
||||
+4
-8
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -17,16 +17,16 @@
|
||||
package org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiPolyVariantReference;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.GroovyResolveResult;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.GroovyPolyVariantReference;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.types.GrTypeElement;
|
||||
|
||||
/**
|
||||
* @author ven
|
||||
*/
|
||||
public interface GrSafeCastExpression extends GrExpression, PsiPolyVariantReference {
|
||||
public interface GrSafeCastExpression extends GrExpression, GroovyPolyVariantReference {
|
||||
|
||||
@Nullable
|
||||
GrTypeElement getCastTypeElement();
|
||||
|
||||
@@ -35,8 +35,4 @@ public interface GrSafeCastExpression extends GrExpression, PsiPolyVariantRefere
|
||||
|
||||
@NotNull
|
||||
PsiElement getOperationToken();
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
GroovyResolveResult[] multiResolve(final boolean incompleteCode);
|
||||
}
|
||||
|
||||
+4
-8
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -17,16 +17,16 @@
|
||||
package org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiPolyVariantReference;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.GroovyResolveResult;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.GroovyPolyVariantReference;
|
||||
|
||||
/**
|
||||
* @author ilyas
|
||||
*/
|
||||
public interface GrUnaryExpression extends GrExpression, PsiPolyVariantReference {
|
||||
public interface GrUnaryExpression extends GrExpression, GroovyPolyVariantReference {
|
||||
|
||||
@NotNull
|
||||
IElementType getOperationTokenType();
|
||||
|
||||
@@ -36,9 +36,5 @@ public interface GrUnaryExpression extends GrExpression, PsiPolyVariantReference
|
||||
@Nullable
|
||||
GrExpression getOperand();
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
GroovyResolveResult[] multiResolve(final boolean incompleteCode);
|
||||
|
||||
boolean isPostfix();
|
||||
}
|
||||
|
||||
+1
-1
@@ -18,9 +18,9 @@ package org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.path;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.GroovyPolyVariantReference;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.arguments.GrArgumentList;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpression;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.GroovyPolyVariantReference;
|
||||
|
||||
public interface GrIndexProperty extends GrExpression {
|
||||
|
||||
|
||||
-6
@@ -217,12 +217,6 @@ public class GrArgumentLabelImpl extends GroovyPsiElementImpl implements GrArgum
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public GroovyResolveResult advancedResolve() {
|
||||
return PsiImplUtil.extractUniqueResult(multiResolve(false));
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getCanonicalText() {
|
||||
|
||||
+1
-1
@@ -25,6 +25,7 @@ import com.intellij.psi.PsiType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.GroovyElementVisitor;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.GroovyPolyVariantReference;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.arguments.GrArgumentList;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpression;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.path.GrIndexProperty;
|
||||
@@ -32,7 +33,6 @@ import org.jetbrains.plugins.groovy.lang.psi.dataFlow.types.TypeInferenceHelper;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.GrExpressionImpl;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.util.GroovyIndexPropertyUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.util.GroovyLValueUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.GroovyPolyVariantReference;
|
||||
import org.jetbrains.plugins.groovy.lang.typing.GrTypeCalculator;
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -18,6 +18,7 @@ package org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.path
|
||||
import com.intellij.openapi.util.TextRange
|
||||
import com.intellij.psi.PsiPolyVariantReferenceBase
|
||||
import com.intellij.psi.PsiType
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.GroovyPolyVariantReference
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.GroovyResolveResult
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrAssignmentExpression
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.path.GrIndexProperty
|
||||
@@ -26,7 +27,6 @@ import org.jetbrains.plugins.groovy.lang.psi.impl.GrTupleType
|
||||
import org.jetbrains.plugins.groovy.lang.psi.util.getArgumentListType
|
||||
import org.jetbrains.plugins.groovy.lang.psi.util.isClassLiteral
|
||||
import org.jetbrains.plugins.groovy.lang.psi.util.isSimpleArrayAccess
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.GroovyPolyVariantReference
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil
|
||||
|
||||
class GrIndexPropertyReference(element: GrIndexPropertyImpl, val rhs: Boolean)
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -45,7 +45,7 @@ import java.util.HashMap;
|
||||
/**
|
||||
* @author ven
|
||||
*/
|
||||
public class GrSafeCastExpressionImpl extends GrExpressionImpl implements GrSafeCastExpression, PsiPolyVariantReference {
|
||||
public class GrSafeCastExpressionImpl extends GrExpressionImpl implements GrSafeCastExpression {
|
||||
|
||||
private static final Function<GrSafeCastExpressionImpl, PsiType> TYPE_CALCULATOR =
|
||||
(NullableFunction<GrSafeCastExpressionImpl, PsiType>)cast -> {
|
||||
|
||||
Reference in New Issue
Block a user