Java 类com.intellij.psi.impl.source.tree.java.PsiEmptyExpressionImpl 实例源码

项目:intellij-ce-playground    文件:SmartCastProvider.java   
@Nullable
private static PsiType getCastedExpressionType(PsiElement parenthesisOwner) {
  if (parenthesisOwner instanceof PsiTypeCastExpression) {
    final PsiExpression operand = ((PsiTypeCastExpression)parenthesisOwner).getOperand();
    return operand == null ? null : operand.getType();
  }

  if (parenthesisOwner instanceof PsiParenthesizedExpression) {
    PsiElement next = parenthesisOwner.getNextSibling();
    while (next != null && (next instanceof PsiEmptyExpressionImpl || next instanceof PsiErrorElement || next instanceof PsiWhiteSpace)) {
      next = next.getNextSibling();
    }
    if (next instanceof PsiExpression) {
      return ((PsiExpression)next).getType();
    }
  }
  return null;
}
项目:tools-idea    文件:SmartCastProvider.java   
@Nullable
private static PsiType getCastedExpressionType(PsiElement originalPosition) {
  if (INSIDE_TYPECAST_TYPE.accepts(originalPosition)) {
    final PsiTypeCastExpression cast = PsiTreeUtil.getParentOfType(originalPosition, PsiTypeCastExpression.class);
    if (cast != null) {
      final PsiExpression operand = cast.getOperand();
      return operand == null ? null : operand.getType();
    }
  }
  final PsiParenthesizedExpression parens = PsiTreeUtil.getParentOfType(originalPosition, PsiParenthesizedExpression.class, true, PsiStatement.class);
  if (parens != null) {
    final PsiExpression rightSide = parens.getExpression();
    if (rightSide != null) {
      return rightSide.getType();
    }
    PsiElement next = parens.getNextSibling();
    while (next != null && (next instanceof PsiEmptyExpressionImpl || next instanceof PsiErrorElement || next instanceof PsiWhiteSpace)) {
      next = next.getNextSibling();
    }
    if (next instanceof PsiExpression) {
      return ((PsiExpression)next).getType();
    }
    return null;
  }
  return null;
}
项目:consulo-java    文件:SmartCastProvider.java   
private static PsiExpression getCastedExpression(PsiElement parenthesisOwner)
{
    if(parenthesisOwner instanceof PsiTypeCastExpression)
    {
        return ((PsiTypeCastExpression) parenthesisOwner).getOperand();
    }

    if(parenthesisOwner instanceof PsiParenthesizedExpression)
    {
        PsiElement next = parenthesisOwner.getNextSibling();
        while(next != null && (next instanceof PsiEmptyExpressionImpl || next instanceof PsiErrorElement || next instanceof PsiWhiteSpace))
        {
            next = next.getNextSibling();
        }
        if(next instanceof PsiExpression)
        {
            return (PsiExpression) next;
        }
    }
    return null;
}