File tree Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -116,13 +116,12 @@ drop_cached_children <- function(pd) {
116116# ' top level expression, potentially cached.
117117# ' @keywords internal
118118find_pos_id_to_keep <- function (pd ) {
119- if (pd $ is_cached [1 ]) {
120- idx_comment <- which(pd $ token == " COMMENT" )
121- pd $ pos_id [unique(c(1 , idx_comment ))]
122- } else {
123- pd $ pos_id
124- }
119+ if (pd $ is_cached [1 ]) {
120+ pd $ pos_id [c(TRUE , pd [- 1L , " token" ] == " COMMENT" )]
121+ } else {
122+ pd $ pos_id
125123 }
124+ }
126125
127126
128127# ' Turn off styling for parts of the code
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ test_that("top-level test: Caches top-level expressions efficiently on style_tex
5656 cache_deactivate()
5757 not_cached_benchmark <- system.time(style_text(text_styled ))
5858 expect_lt(
59- partially_cached_benchmark [' elapsed' ] * 5 ,
59+ partially_cached_benchmark [' elapsed' ] * 3 ,
6060 not_cached_benchmark [' elapsed' ]
6161 )
6262})
You can’t perform that action at this time.
0 commit comments