Skip to content

Commit

Permalink
handle non-existant/NULL argument 'data'
Browse files Browse the repository at this point in the history
  • Loading branch information
toppyy committed Oct 6, 2024
1 parent f6330e7 commit ec5b2af
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions R/translate.R
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ infer_type_of_expr <- function(
}

types_are_comparable <- function(types) {
# TODO: Incomplete, written for demo
left = types[1]
right = types[2]

Expand All @@ -164,8 +165,9 @@ rel_translate_lang <- function(
pkg <- pkg_name[[1]]
name <- pkg_name[[2]]

if (name %in% c(">","<","=",">=","<=")) {


if (name %in% c(">","<","=",">=","<=") && !is.null(types_data)) {

types <- sapply(
expr[2:3],
infer_type_of_expr,
Expand Down Expand Up @@ -360,7 +362,11 @@ rel_translate <- function(
}

used <- character()
types_data <- sapply(data,typeof)

types_data = NULL
if (hasArg(data) && !is.null(data)) {
types_data <- sapply(data,typeof)
}

do_translate <- function(expr, in_window = FALSE, top_level = FALSE) {
stopifnot(!is_quosure(expr))
Expand Down

0 comments on commit ec5b2af

Please sign in to comment.