Skip to content

Commit

Permalink
lang -> call2
Browse files Browse the repository at this point in the history
  • Loading branch information
romainfrancois authored and lionel- committed Oct 11, 2018
1 parent 64c5aeb commit 8770a56
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 30 deletions.
4 changes: 2 additions & 2 deletions R/compat-dbplyr.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ wrap_dbplyr_obj <- function(obj_name) {
obj <- getExportedValue("dbplyr", obj_name)
obj_sym <- sym(obj_name)

dbplyr_sym <- lang("::", quote(dbplyr), obj_sym)
dplyr_sym <- lang("::", quote(dplyr), obj_sym)
dbplyr_sym <- call2("::", quote(dbplyr), obj_sym)
dplyr_sym <- call2("::", quote(dplyr), obj_sym)

if (is.function(obj)) {
args <- formals()
Expand Down
2 changes: 1 addition & 1 deletion R/funs.R
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ as_fun <- function(.x, .env, .args) {
if (is_call(expr) && !is_call(expr, c("::", ":::"))) {
expr <- lang_modify(expr, !!!.args)
} else {
expr <- lang(expr, quote(.), !!!.args)
expr <- call2(expr, quote(.), !!!.args)
}

set_expr(quo, expr)
Expand Down
22 changes: 11 additions & 11 deletions docs/articles/compatibility.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 12 additions & 12 deletions docs/dev/articles/compatibility.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/testthat/test-funs.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ test_that("funs() accepts quoted functions", {

test_that("funs() accepts unquoted functions", {
funs <- funs(fn = !!mean)
expect_identical(funs$fn, new_quosure(lang(base::mean, quote(.))))
expect_identical(funs$fn, new_quosure(call2(base::mean, quote(.))))
})

test_that("funs() accepts quoted calls", {
Expand Down
6 changes: 3 additions & 3 deletions vignettes/compatibility.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -160,16 +160,16 @@ fun <- rlang::sym("my_call")
quo((!!fun)(!!! syms))
```

Or create the call with `lang()`:
Or create the call with `call2()`:

```{r}
call <- rlang::lang("my_call", !!! syms)
call <- rlang::call2("my_call", !!! syms)
call
rlang::as_quosure(call)
# Or equivalently:
quo(!! rlang::lang("my_call", !!! syms))
quo(!! rlang::call2("my_call", !!! syms))
```

Note that idioms based on `interp()` should now generally be avoided
Expand Down

0 comments on commit 8770a56

Please sign in to comment.