Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions program/shinyApp/R/code_generation/util.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ clean_function_code <- function(f) {
# Trim any leading/trailing whitespace
f_out <- trimws(f_out)

# Reattach `else`/`else if` to the preceding closing brace. deparse() places
# `else` on its own line, which is valid inside a function body but a syntax
# error once this body is inlined at the top level of the generated script.
f_out <- gsub("\\}[[:space:]]*\\n[[:space:]]*else", "} else", f_out)

return(f_out)
}

Expand Down
Loading