private void print(FunctionNode node) throws IOException { if (!node.isMethod()) { writer.append("function"); } if (node.getFunctionName() != null) { writer.append(' '); print(node.getFunctionName()); } writer.append('('); printList(node.getParams()); writer.append(')').ws(); if (node.isExpressionClosure()) { if (node.getBody().getLastChild() instanceof ReturnStatement) { print(((ReturnStatement) node.getBody().getLastChild()).getReturnValue()); if (node.getFunctionType() == FunctionNode.FUNCTION_STATEMENT) { writer.append(";"); } } } else { print(node.getBody()); } }
private void print(FunctionNode node) throws IOException { if (!node.isMethod()) { writer.append("function"); } if (node.getFunctionName() != null) { writer.append(' '); print(node.getFunctionName()); } writer.append('('); printList(node.getParams()); writer.append(')').ws(); if (node.isExpressionClosure()) { if (node.getBody().getLastChild() instanceof ReturnStatement) { print(((ReturnStatement) node.getBody().getLastChild()).getReturnValue()); if (node.getFunctionType() == FunctionNode.FUNCTION_STATEMENT) { writer.append(";"); } } } else { print(node.getBody()); } }