private void appendSplitReturn(final int splitState, final int lineNumber) { appendStatement(new SetSplitState(splitState, lineNumber)); if (getCurrentFunctionState().fn.isProgram()) { // If we're splitting the program, make sure every fragment passes back :return appendStatement(createReturnReturn()); } else { appendStatement(SplitReturn.INSTANCE); } }
@Override public Node leaveReturnNode(final ReturnNode returnNode) { if(inSplitNode()) { appendStatement(new SetSplitState(RETURN_STATE, returnNode.getLineNumber())); getCurrentSplitState().hasReturn = true; } appendStatement(returnNode); return returnNode; }
@Override public boolean enterSetSplitState(final SetSplitState setSplitState) { if (method.isReachable()) { method.setSplitState(setSplitState.getState()); } return false; }
/** * Callback for entering a {@link SetSplitState}. * * @param setSplitState the set split state statement * @return true if traversal should continue and node children be traversed, false otherwise */ public boolean enterSetSplitState(final SetSplitState setSplitState) { return enterDefault(setSplitState); }
/** * Callback for leaving a {@link SetSplitState}. * * @param setSplitState the set split state expression * @return processed node, which will replace the original one, or the original node */ public Node leaveSetSplitState(final SetSplitState setSplitState) { return leaveDefault(setSplitState); }