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


Java PsiUtil.skipParenthesizedExprDown方法代码示例

本文整理汇总了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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ControlFlowAnalyzer.java

示例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);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:VariableNotUsedInsideIfInspection.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:35,代码来源:ControlFlowAnalyzer.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:MagicCompletionContributor.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:MoveFieldAssignmentToInitializerAction.java


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