Java 类com.intellij.psi.impl.source.resolve.CompletionParameterTypeInferencePolicy 实例源码

项目:intellij-ce-playground    文件:ExpectedTypeUtil.java   
@Nullable
public static PsiSubstitutor inferSubstitutor(final PsiMethod method, final PsiMethodCallExpression callExpr, boolean forCompletion) {
  final PsiResolveHelper helper = JavaPsiFacade.getInstance(method.getProject()).getResolveHelper();
  final PsiParameter[] parameters = method.getParameterList().getParameters();
  PsiExpression[] args = callExpr.getArgumentList().getExpressions();
  PsiSubstitutor result = PsiSubstitutor.EMPTY;
  for (PsiTypeParameter typeParameter : PsiUtil.typeParametersIterable(method.getContainingClass())) {
    PsiType type = helper.inferTypeForMethodTypeParameter(typeParameter, parameters, args, PsiSubstitutor.EMPTY, callExpr.getParent(),
                                                          forCompletion ? CompletionParameterTypeInferencePolicy.INSTANCE : DefaultParameterTypeInferencePolicy.INSTANCE);
    if (PsiType.NULL.equals(type)) return null;
    result = result.put(typeParameter, type);
  }

  return result;
}
项目:tools-idea    文件:ExpectedTypeUtil.java   
@Nullable
public static PsiSubstitutor inferSubstitutor(final PsiMethod method, final PsiMethodCallExpression callExpr, boolean forCompletion) {
  final PsiResolveHelper helper = JavaPsiFacade.getInstance(method.getProject()).getResolveHelper();
  final PsiParameter[] parameters = method.getParameterList().getParameters();
  PsiExpression[] args = callExpr.getArgumentList().getExpressions();
  PsiSubstitutor result = PsiSubstitutor.EMPTY;
  for (PsiTypeParameter typeParameter : PsiUtil.typeParametersIterable(method.getContainingClass())) {
    PsiType type = helper.inferTypeForMethodTypeParameter(typeParameter, parameters, args, PsiSubstitutor.EMPTY, callExpr.getParent(),
                                                          forCompletion ? CompletionParameterTypeInferencePolicy.INSTANCE : DefaultParameterTypeInferencePolicy.INSTANCE);
    if (PsiType.NULL.equals(type)) return null;
    result = result.put(typeParameter, type);
  }

  return result;
}
项目:consulo-java    文件:ExpectedTypeUtil.java   
@Nullable
public static PsiSubstitutor inferSubstitutor(final PsiMethod method, final PsiMethodCallExpression callExpr, boolean forCompletion) {
  final PsiResolveHelper helper = JavaPsiFacade.getInstance(method.getProject()).getResolveHelper();
  final PsiParameter[] parameters = method.getParameterList().getParameters();
  PsiExpression[] args = callExpr.getArgumentList().getExpressions();
  PsiSubstitutor result = PsiSubstitutor.EMPTY;
  for (PsiTypeParameter typeParameter : PsiUtil.typeParametersIterable(method.getContainingClass())) {
    PsiType type = helper.inferTypeForMethodTypeParameter(typeParameter, parameters, args, PsiSubstitutor.EMPTY, callExpr.getParent(),
                                                          forCompletion ? CompletionParameterTypeInferencePolicy.INSTANCE : DefaultParameterTypeInferencePolicy.INSTANCE);
    if (PsiType.NULL.equals(type)) return null;
    result = result.put(typeParameter, type);
  }

  return result;
}
项目:intellij-ce-playground    文件:MethodParameterInfoHandler.java   
private static PsiSubstitutor getCandidateInfoSubstitutor(CandidateInfo candidate) {
  return candidate instanceof MethodCandidateInfo && ((MethodCandidateInfo)candidate).isInferencePossible()
                               ? ((MethodCandidateInfo)candidate).inferTypeArguments(CompletionParameterTypeInferencePolicy.INSTANCE, true)
                               : candidate.getSubstitutor();
}
项目:tools-idea    文件:MethodParameterInfoHandler.java   
private static PsiSubstitutor getCandidateInfoSubstitutor(CandidateInfo candidate) {
  return candidate instanceof MethodCandidateInfo && ((MethodCandidateInfo)candidate).isInferencePossible()
                               ? ((MethodCandidateInfo)candidate).inferTypeArguments(CompletionParameterTypeInferencePolicy.INSTANCE)
                               : candidate.getSubstitutor();
}
项目:consulo-java    文件:MethodParameterInfoHandler.java   
private static PsiSubstitutor getCandidateInfoSubstitutor(CandidateInfo candidate)
{
    return candidate instanceof MethodCandidateInfo && ((MethodCandidateInfo) candidate).isInferencePossible() ? ((MethodCandidateInfo) candidate).inferTypeArguments
            (CompletionParameterTypeInferencePolicy.INSTANCE, true) : candidate.getSubstitutor();
}