本文整理汇总了Java中com.intellij.psi.util.PsiUtil.skipParenthesizedExprDown方法的典型用法代码示例。如果您正苦于以下问题:Java PsiUtil.skipParenthesizedExprDown方法的具体用法?Java PsiUtil.skipParenthesizedExprDown怎么用?Java PsiUtil.skipParenthesizedExprDown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.psi.util.PsiUtil
的用法示例。
在下文中一共展示了PsiUtil.skipParenthesizedExprDown方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visitPostfixExpression
import com.intellij.psi.util.PsiUtil; //导入方法依赖的package包/类
@Override
public void visitPostfixExpression(PsiPostfixExpression expression) {
startElement(expression);
IElementType op = expression.getOperationTokenType();
PsiExpression operand = PsiUtil.skipParenthesizedExprDown(expression.getOperand());
if (operand != null) {
operand.accept(this);
if (op == JavaTokenType.PLUSPLUS || op == JavaTokenType.MINUSMINUS) {
if (operand instanceof PsiReferenceExpression) {
PsiVariable variable = getUsedVariable((PsiReferenceExpression)operand);
if (variable != null) {
generateWriteInstruction(variable);
}
}
}
}
finishElement(expression);
}
示例2: visitConditionalExpression
import com.intellij.psi.util.PsiUtil; //导入方法依赖的package包/类
@Override
public void visitConditionalExpression(PsiConditionalExpression expression) {
super.visitConditionalExpression(expression);
final PsiExpression condition = PsiUtil.skipParenthesizedExprDown(expression.getCondition());
if (!(condition instanceof PsiBinaryExpression)) {
return;
}
final PsiBinaryExpression binaryExpression = (PsiBinaryExpression)condition;
final PsiReferenceExpression referenceExpression = extractVariableReference(binaryExpression);
if (referenceExpression == null) {
return;
}
final IElementType tokenType = binaryExpression.getOperationTokenType();
if (tokenType == JavaTokenType.EQEQ) {
if (checkVariableUsage(referenceExpression, expression.getThenExpression(), expression.getElseExpression())) {
registerError(referenceExpression, Boolean.FALSE);
}
}
else if (tokenType == JavaTokenType.NE) {
if (checkVariableUsage(referenceExpression, expression.getElseExpression(), expression.getThenExpression())) {
registerError(referenceExpression, Boolean.FALSE);
}
}
}
示例3: visitPrefixExpression
import com.intellij.psi.util.PsiUtil; //导入方法依赖的package包/类
@Override
public void visitPrefixExpression(PsiPrefixExpression expression) {
startElement(expression);
PsiExpression operand = PsiUtil.skipParenthesizedExprDown(expression.getOperand());
if (operand != null) {
IElementType operationSign = expression.getOperationTokenType();
if (operationSign == JavaTokenType.EXCL) {
// negation inverts jump targets
PsiElement topStartStatement = myStartStatementStack.peekElement();
boolean topAtStart = myStartStatementStack.peekAtStart();
myStartStatementStack.pushStatement(myEndStatementStack.peekElement(), myEndStatementStack.peekAtStart());
myEndStatementStack.pushStatement(topStartStatement, topAtStart);
}
operand.accept(this);
if (operationSign == JavaTokenType.EXCL) {
// negation inverts jump targets
myStartStatementStack.popStatement();
myEndStatementStack.popStatement();
}
if (operand instanceof PsiReferenceExpression &&
(operationSign == JavaTokenType.PLUSPLUS || operationSign == JavaTokenType.MINUSMINUS)) {
PsiVariable variable = getUsedVariable((PsiReferenceExpression)operand);
if (variable != null) {
generateWriteInstruction(variable);
}
}
}
finishElement(expression);
}
示例4: resolveExpression
import com.intellij.psi.util.PsiUtil; //导入方法依赖的package包/类
@Nullable
private static PsiModifierListOwner resolveExpression(@Nullable PsiExpression expression) {
expression = PsiUtil.skipParenthesizedExprDown(expression);
if (expression instanceof PsiMethodCallExpression) {
return ((PsiMethodCallExpression)expression).resolveMethod();
}
if (expression instanceof PsiReferenceExpression) {
PsiElement resolved = ((PsiReferenceExpression)expression).resolve();
if (resolved instanceof PsiModifierListOwner) {
return (PsiModifierListOwner)resolved;
}
}
return null;
}
示例5: getAssignedField
import com.intellij.psi.util.PsiUtil; //导入方法依赖的package包/类
private static PsiField getAssignedField(final PsiAssignmentExpression assignment) {
PsiExpression lExpression = PsiUtil.skipParenthesizedExprDown(assignment.getLExpression());
if (!(lExpression instanceof PsiReferenceExpression)) return null;
PsiElement resolved = ((PsiReferenceExpression)lExpression).resolve();
if (!(resolved instanceof PsiField)) return null;
return (PsiField)resolved;
}