public void visitReturnStatement(GrReturnStatement returnStatement) { boolean isNodeNeeded = myHead == null || myHead.getElement() != returnStatement; final GrExpression value = returnStatement.getReturnValue(); if (value != null) value.accept(this); if (isNodeNeeded) { InstructionImpl returnInstruction = startNode(returnStatement); addPendingEdge(null, myHead); finishNode(returnInstruction); } else { addPendingEdge(null, myHead); } interruptFlow(); }
@Override public void visitReturnStatement(final GrReturnStatement returnStatement) { final GrExpression returnValue = returnStatement.getReturnValue(); if (returnValue == null) { builder.append("return;\n"); return; } writeStatement( returnStatement, new StatementWriter() { @Override public void writeStatement(StringBuilder builder, ExpressionContext context) { writeReturn(builder, context, returnValue); } }); }
private static boolean returnStatementsAreEquivalent( @NotNull GrReturnStatement statement1, @NotNull GrReturnStatement statement2) { final GrExpression returnValue1 = statement1.getReturnValue(); final GrExpression returnValue2 = statement2.getReturnValue(); return expressionsAreEquivalent(returnValue1, returnValue2); }