当前位置: 首页>>代码示例>>Java>>正文


Java PsiUtil.skipParenthesizedExprUp方法代码示例

本文整理汇总了Java中com.intellij.psi.util.PsiUtil.skipParenthesizedExprUp方法的典型用法代码示例。如果您正苦于以下问题:Java PsiUtil.skipParenthesizedExprUp方法的具体用法?Java PsiUtil.skipParenthesizedExprUp怎么用?Java PsiUtil.skipParenthesizedExprUp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.psi.util.PsiUtil的用法示例。


在下文中一共展示了PsiUtil.skipParenthesizedExprUp方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPlaceExpectedType

import com.intellij.psi.util.PsiUtil; //导入方法依赖的package包/类
@Nullable
private static PsiType getPlaceExpectedType(PsiElement parent) {
  PsiType type = PsiTypesUtil.getExpectedTypeByParent((PsiExpression)parent);
  if (type == null) {
    final PsiElement arg = PsiUtil.skipParenthesizedExprUp(parent);
    final PsiElement gParent = arg.getParent();
    if (gParent instanceof PsiExpressionList) {
      int i = ArrayUtilRt.find(((PsiExpressionList)gParent).getExpressions(), arg);
      final PsiElement pParent = gParent.getParent();
      if (pParent instanceof PsiCallExpression) {
        final PsiMethod method = ((PsiCallExpression)pParent).resolveMethod();
        if (method != null) {
          final PsiParameter[] parameters = method.getParameterList().getParameters();
          if (i >= parameters.length) {
            if (method.isVarArgs()) {
              return ((PsiEllipsisType)parameters[parameters.length - 1].getType()).getComponentType();
            }
          } else {
            return parameters[i].getType();
          }
        }
      }
    }
  }
  return type;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:InlineSuperClassRefactoringProcessor.java

示例2: isInAssignmentOrInvocationContext

import com.intellij.psi.util.PsiUtil; //导入方法依赖的package包/类
private static boolean isInAssignmentOrInvocationContext(PsiExpression expr) {
  final PsiElement context = PsiUtil.skipParenthesizedExprUp(expr.getParent());
  return context instanceof PsiExpressionList || 
         context instanceof PsiArrayInitializerExpression || 
         context instanceof PsiConditionalExpression && (expr instanceof PsiCallExpression || isPolyExpression((PsiExpression)context)) || 
         isAssignmentContext(expr, context);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:PsiPolyExpressionUtil.java

示例3: isCodeBlockRedundant

import com.intellij.psi.util.PsiUtil; //导入方法依赖的package包/类
public static PsiExpression isCodeBlockRedundant(PsiExpression expression, PsiElement body) {
  if (body instanceof PsiCodeBlock) {
    PsiExpression psiExpression = LambdaUtil.extractSingleExpressionFromBody(body);
    if (psiExpression != null && !findCommentsOutsideExpression(body, psiExpression)) {
      if (LambdaUtil.isExpressionStatementExpression(psiExpression)) {
        final PsiElement parent = PsiUtil.skipParenthesizedExprUp(expression.getParent());
        if (parent instanceof PsiExpressionList) {
          final PsiElement gParent = parent.getParent();
          if (gParent instanceof PsiCallExpression) {
            final CandidateInfo[] candidates = PsiResolveHelper.SERVICE.getInstance(gParent.getProject())
              .getReferencedMethodCandidates((PsiCallExpression)gParent, false, true);
            if (candidates.length > 1) {
              final List<CandidateInfo> info = new ArrayList<CandidateInfo>(Arrays.asList(candidates));
              final LanguageLevel level = PsiUtil.getLanguageLevel(parent);
              final JavaMethodsConflictResolver conflictResolver = new JavaMethodsConflictResolver((PsiExpressionList)parent, level);
              final PsiExpressionList argumentList = ((PsiCallExpression)gParent).getArgumentList();
              if (argumentList == null) {
                return null;
              }
              conflictResolver.checkParametersNumber(info, argumentList.getExpressions().length, false);
              conflictResolver.checkSpecifics(info, MethodCandidateInfo.ApplicabilityLevel.VARARGS, level);
              if (info.size() > 1) {
                return null;
              }
            }
          }
        }
      }
      return psiExpression;
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:RedundantLambdaCodeBlockInspection.java


注:本文中的com.intellij.psi.util.PsiUtil.skipParenthesizedExprUp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。