本文整理汇总了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;
}
示例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);
}
示例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;
}