Skip to content

Commit af479d1

Browse files
move regex back to run-time generation for robustness
1 parent 12d5799 commit af479d1

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

R/data.table.R

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -96,20 +96,20 @@ replace_dot_alias = function(e) {
9696
x
9797
}
9898

99-
# a slightly wonky workaround so that this still works in non-English sessions, #4989
100-
# generate this at run time (as opposed to e.g. onAttach) since session language is
101-
# technically OK to update (though this should be rare), and since it's low-cost
102-
# to do so here because we're about to error anyway.
103-
.missing_obj_regex = gsub(
104-
"'____missing_datatable_variable____'",
105-
"'(?<obj_name>[^']+)'",
106-
# expression() to avoid "no visible binding for global variable" note from R CMD check
107-
conditionMessage(tryCatch(eval(expression(`____missing_datatable_variable____`)), error=identity)),
108-
fixed=TRUE
109-
)
11099
.checkTypos = function(err, ref) {
111100
err_str <- conditionMessage(err)
112-
idx = regexpr(.missing_obj_regex, err_str, perl=TRUE)
101+
# a slightly wonky workaround so that this still works in non-English sessions, #4989
102+
# generate this at run time (as opposed to e.g. onAttach) since session language is
103+
# technically OK to update (though this should be rare), and since it's low-cost
104+
# to do so here because we're about to error anyway.
105+
missing_obj_regex = gsub(
106+
"'____missing_datatable_variable____'",
107+
"'(?<obj_name>[^']+)'",
108+
# expression() to avoid "no visible binding for global variable" note from R CMD check
109+
conditionMessage(tryCatch(eval(expression(`____missing_datatable_variable____`)), error=identity)),
110+
fixed=TRUE
111+
)
112+
idx = regexpr(missing_obj_regex, err_str, perl=TRUE)
113113
if (idx == -1L)
114114
stopf("%s", err_str, domain=NA) # Don't use stopf() directly, since err_str might have '%', #6588
115115
start = attr(idx, "capture.start", exact=TRUE)[ , "obj_name"]

0 commit comments

Comments
 (0)