Skip to content

Commit a7b43b3

Browse files
committed
Pass around calls
1 parent 52d4a65 commit a7b43b3

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

R/scale-.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,7 @@ ScaleContinuous <- ggproto("ScaleContinuous", Scale,
887887
c("aesthetics", "scale_name", "super", "call", "position")
888888
),
889889

890-
update_params = function(self, params, default = FALSE) {
890+
update_params = function(self, params, default = FALSE, call = NULL) {
891891

892892
if ("trans" %in% names(params)) {
893893
# We're using the old transform to revert the limits to input data, so
@@ -896,7 +896,7 @@ ScaleContinuous <- ggproto("ScaleContinuous", Scale,
896896
self$limits <- self$trans$inverse(self$limits)
897897
}
898898
}
899-
ggproto_parent(Scale, self)$update_params(params, default = default)
899+
ggproto_parent(Scale, self)$update_params(params, default = default, call = call)
900900
return()
901901
},
902902

R/scale-partial.R

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
scale_x <- function(...) scale_partial(aesthetic = "x", ...)
44
scale_y <- function(...) scale_partial(aesthetic = "y", ...)
55

6-
scale_partial <- function(aesthetic, ..., call = caller_env()) {
6+
scale_partial <- function(aesthetic, ..., call = caller_call()) {
77

88
check_string(aesthetic, allow_empty = FALSE)
99
aesthetic <- standardise_aes_names(aesthetic)
@@ -21,8 +21,11 @@ scale_partial <- function(aesthetic, ..., call = caller_env()) {
2121
)
2222
args[lambdas] <- lapply(args[lambdas], allow_lambda)
2323

24+
call <- call %||% current_call()
25+
2426
ggproto(
2527
NULL, ScalePartial,
28+
call = call,
2629
aesthetics = aesthetic,
2730
params = args
2831
)
@@ -33,8 +36,9 @@ ScalePartial <- ggproto(
3336

3437
aesthetics = character(),
3538
params = list(),
39+
call = NULL,
3640

37-
update_params = function(self, params, default = FALSE) {
41+
update_params = function(self, params, default = FALSE, call = self$call) {
3842
self$params <- defaults(params, self$params)
3943
},
4044

R/scales-.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ ScalesList <- ggproto("ScalesList", NULL,
3636
# `default = TRUE` here because upon adding a partial scale,
3737
# we need to override parameters, regardless of whether `prev_scale` is
3838
# a full or partial scale.
39-
prev_scale$update_params(scale$params, default = TRUE)
39+
prev_scale$update_params(scale$params, default = TRUE, call = scale$call)
4040
self$scales <- c(self$scales[!prev_aes], list(prev_scale))
4141
return()
4242
}
@@ -45,7 +45,8 @@ ScalesList <- ggproto("ScalesList", NULL,
4545
if (!default) {
4646
scale <- scale$clone()
4747
}
48-
scale$update_params(prev_scale$params, default = default)
48+
scale$update_params(prev_scale$params, default = default,
49+
call = prev_scale$call)
4950
self$scales <- c(self$scales[!prev_aes], list(scale))
5051
return()
5152
}

0 commit comments

Comments
 (0)