Skip to content

Commit 55a0311

Browse files
attempt to simplify (i'm probably wrong)
1 parent 006864a commit 55a0311

1 file changed

Lines changed: 3 additions & 11 deletions

File tree

R/data.table.R

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ replace_dot_alias = function(e) {
128128
}
129129
}
130130

131-
.reassign_extracted_table = function(name, value, env, err_msg_detail, err_msg_na) {
131+
.reassign_extracted_table = function(name, value, env = parent.frame(), err_msg_na, err_msg_detail = NULL) {
132132
k = eval(name[[2L]], env, env)
133133
if (is.list(k)) {
134134
origj = j = if (name %iscall% "$") as.character(name[[3L]]) else eval(name[[3L]], env, env)
@@ -1244,11 +1244,7 @@ replace_dot_alias = function(e) {
12441244
if (is.name(name)) {
12451245
assign(as.character(name),x,parent.frame(),inherits=TRUE)
12461246
} else if (.is_simple_extraction(name)) {
1247-
.reassign_extracted_table(
1248-
name, x, parent.frame(),
1249-
err_msg_detail = "L[[i]][,:=]",
1250-
err_msg_na = NULL # Shouldn't be needed; triggers internal error if so
1251-
)
1247+
.reassign_extracted_table(name, x, parent.frame(), err_msg_detail = "L[[i]][,:=]")
12521248
} # TO DO: else if env$<- or list$<-
12531249
}
12541250
}
@@ -2993,11 +2989,7 @@ setDT = function(x, keep.rownames=FALSE, key=NULL, check.names=FALSE) {
29932989
assign(name, x, parent.frame(), inherits=TRUE)
29942990
} else if (.is_simple_extraction(name)) {
29952991
# common case is call from 'lapply()'
2996-
.reassign_extracted_table(
2997-
name, x, parent.frame(),
2998-
err_msg_detail = "setDT(L[[i]])",
2999-
err_msg_na = "Item '%s' not found in names of input list"
3000-
)
2992+
.reassign_extracted_table(name, x, err_msg_detail = "setDT(L[[i]])", err_msg_na = "Item '%s' not found in names of input list")
30012993
} else if (name %iscall% "get") { # #6725
30022994
# edit 'get(nm, env)' call to be 'assign(nm, x, envir=env)'
30032995
name = match.call(get, name)

0 commit comments

Comments
 (0)