Skip to content

Commit a4d7d81

Browse files
krlmlrclauswilke
authored andcommitted
Force arguments that are used in closures (#2807)
1 parent 26f7a39 commit a4d7d81

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

R/save.r

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,10 @@ plot_dim <- function(dim = c(NA, NA), scale = 1, units = c("in", "cm", "mm"),
118118
dim
119119
}
120120

121-
plot_dev <- function(device, filename, dpi = 300) {
121+
plot_dev <- function(device, filename = NULL, dpi = 300) {
122+
force(filename)
123+
force(dpi)
124+
122125
if (is.function(device))
123126
return(device)
124127

R/scale-manual.r

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ scale_discrete_manual <- function(aesthetics, ..., values) {
102102

103103

104104
manual_scale <- function(aesthetic, values, ...) {
105+
force(values)
106+
105107
pal <- function(n) {
106108
if (n > length(values)) {
107109
stop("Insufficient values in manual scale. ", n, " needed but only ",

R/scale-size.r

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ scale_size_discrete <- function(...) {
6868
#' @export
6969
#' @usage NULL
7070
scale_size_ordinal <- function(..., range = c(2, 6)) {
71+
force(range)
72+
7173
discrete_scale(
7274
"size",
7375
"size_d",

R/stat-summary-bin.R

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ StatSummaryBin <- ggproto("StatSummaryBin", Stat,
6565
)
6666

6767
make_summary_fun <- function(fun.data, fun.y, fun.ymax, fun.ymin, fun.args) {
68+
force(fun.data)
69+
force(fun.y)
70+
force(fun.ymax)
71+
force(fun.ymin)
72+
force(fun.args)
73+
6874
if (!is.null(fun.data)) {
6975
# Function that takes complete data frame as input
7076
fun.data <- match.fun(fun.data)

0 commit comments

Comments
 (0)