Skip to content

Commit 3727d10

Browse files
committed
Quote symbolic arguments before formatting
1 parent be99275 commit 3727d10

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

crates/harp/src/exec.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,9 @@ pub fn r_source_exprs_in(exprs: impl Into<SEXP>, env: impl Into<SEXP>) -> crate:
472472
let exprs = exprs.into();
473473
let env = env.into();
474474

475+
// `exprs` is an EXPRSXP and doesn't need to be quoted when passed as
476+
// literal argument. Only the R-level `eval()` function evaluates expression
477+
// vectors.
475478
RFunction::new("base", "source")
476479
.param("exprs", exprs)
477480
.param("local", env)

crates/harp/src/utils.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use libr::*;
1414
use once_cell::sync::Lazy;
1515
use regex::Regex;
1616

17+
use crate::call::r_expr_quote;
1718
use crate::call::RArgument;
1819
use crate::environment::Environment;
1920
use crate::environment::R_ENVS;
@@ -401,7 +402,9 @@ pub unsafe fn r_stringify(object: SEXP, delimiter: &str) -> Result<String> {
401402
}
402403

403404
// call format on the object
404-
let object = RFunction::new("base", "format").add(object).call()?;
405+
let object = RFunction::new("base", "format")
406+
.add(r_expr_quote(object))
407+
.call()?;
405408

406409
// paste into a single string
407410
let object = RFunction::new("base", "paste")

0 commit comments

Comments
 (0)