Skip to content

Commit 9d20e91

Browse files
speed
1 parent 1d2b9f6 commit 9d20e91

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

R/nest.R

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ add_cache_block <- function(pd_nested) {
3939
if (cache_is_activated()) {
4040
pd_nested$block <- cache_find_block(pd_nested)
4141
} else {
42-
pd_nested$block <- rep(1, nrow(pd_nested))
42+
pd_nested$block <- rep(1, length(pd_nested$block))
4343
}
4444
pd_nested
4545
}
@@ -247,9 +247,10 @@ add_terminal_token_before <- function(pd_flat) {
247247
add_attributes_caching <- function(pd_flat, transformers) {
248248
pd_flat$block <- pd_flat$is_cached <- rep(NA, nrow(pd_flat))
249249
if (cache_is_activated()) {
250-
pd_flat$is_cached[pd_flat$parent == 0] <- map_lgl(
250+
is_parent <- pd_flat$parent == 0
251+
pd_flat$is_cached[is_parent] <- map_lgl(
251252
pd_flat$text[pd_flat$parent == 0],
252-
is_cached, transformers, cache_dir_default()
253+
is_cached, transformers
253254
)
254255
is_comment <- pd_flat$token == "COMMENT"
255256
pd_flat$is_cached[is_comment] <- rep(FALSE, sum(is_comment))

0 commit comments

Comments
 (0)