@Override public boolean matches(final INode other, final Match match) { if (other instanceof CastExpression) { final CastExpression otherCast = (CastExpression) other; return !otherCast.isNull() && getType().matches(otherCast.getType(), match) && getExpression().matches(otherCast.getExpression(), match); } return false; } }
@Override public boolean matches(final INode other, final Match match) { if (other instanceof CastExpression) { final CastExpression otherCast = (CastExpression) other; return !otherCast.isNull() && getType().matches(otherCast.getType(), match) && getExpression().matches(otherCast.getExpression(), match); } return false; } }
@Override public boolean matches(final INode other, final Match match) { if (other instanceof CastExpression) { final CastExpression otherCast = (CastExpression) other; return !otherCast.isNull() && getType().matches(otherCast.getType(), match) && getExpression().matches(otherCast.getExpression(), match); } return false; } }
public static void removeCast(final CastExpression castExpression) { if (castExpression == null || castExpression.isNull()) { return; } Expression operand = castExpression.getExpression(); if (operand instanceof ParenthesizedExpression) { operand = ((ParenthesizedExpression) operand).getExpression(); } if (operand.isNull()) { return; } AstNode toBeReplaced = castExpression; AstNode parent = castExpression.getParent(); while (parent instanceof ParenthesizedExpression) { toBeReplaced = parent; parent = parent.getParent(); } toBeReplaced.replaceWith(operand); }
public static void removeCast(final CastExpression castExpression) { if (castExpression == null || castExpression.isNull()) { return; } Expression operand = castExpression.getExpression(); if (operand instanceof ParenthesizedExpression) { operand = ((ParenthesizedExpression) operand).getExpression(); } if (operand == null || operand.isNull()) { return; } AstNode toBeReplaced = castExpression; AstNode parent = castExpression.getParent(); while (parent instanceof ParenthesizedExpression) { toBeReplaced = parent; parent = parent.getParent(); } toBeReplaced.replaceWith(operand); }
public static void removeCast(final CastExpression castExpression) { if (castExpression == null || castExpression.isNull()) { return; } Expression operand = castExpression.getExpression(); if (operand instanceof ParenthesizedExpression) { operand = ((ParenthesizedExpression) operand).getExpression(); } if (operand == null || operand.isNull()) { return; } AstNode toBeReplaced = castExpression; AstNode parent = castExpression.getParent(); while (parent instanceof ParenthesizedExpression) { toBeReplaced = parent; parent = parent.getParent(); } toBeReplaced.replaceWith(operand); }