Skip to content

Commit 84bc9d4

Browse files
committed
append old uneval class
1 parent d80d209 commit 84bc9d4

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

R/all-classes.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,9 @@ class_mapping <- S7::new_class(
9595
constructor = function(x, env = globalenv()) {
9696
check_object(x, is.list, "a {.cls list}")
9797
x <- lapply(x, new_aesthetic, env = env)
98-
S7::new_object(x)
98+
x <- S7::new_object(x)
99+
class(x) <- union(c("ggplot2::mapping", "uneval"), class(x))
100+
x
99101
}
100102
)
101103

R/labels.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ setup_plot_labels <- function(plot, layers, data) {
2929
if (inherits(mapping, "unlabelled")) {
3030
next
3131
}
32+
mapping <- mapping[have_name(mapping)]
3233

3334
mapping <- strip_stage(mapping)
3435
mapping <- strip_dots(mapping, strip_pronoun = TRUE)

R/layer.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,8 @@ layer <- function(geom = NULL, stat = NULL,
202202
validate_mapping <- function(mapping, call = caller_env()) {
203203
# Upgrade any old S3 input to new S7 input
204204
# TODO: deprecate this after a while
205-
if (inherits(mapping, "uneval") && is.list(mapping)) {
205+
is_old_mapping <- !S7::S7_inherits(mapping) && inherits(mapping, "uneval")
206+
if (is_old_mapping && is.list(mapping)) {
206207
mapping <- aes(!!!mapping)
207208
}
208209

0 commit comments

Comments
 (0)