Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused extend_if_comment() #1250

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion R/utils-cache.R
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ cache_by_expression <- function(text,
} else {
expressions$stylerignore <- rep(FALSE, length(expressions$text))
}
# TODO base_indention should be set to 0 on write and on read for expressions
# TODO base_indention should be set to 0 on write and on read for expressions
# (only) to make it possible to use the cache for expressions with different
# indention. when not the whole input text is cached, we go trough all
# expressions and check if they are cached, if yes, we take the input (from
Expand Down
17 changes: 0 additions & 17 deletions R/utils-navigate-nest.R
Original file line number Diff line number Diff line change
Expand Up @@ -83,20 +83,3 @@ next_terminal <- function(pd,
}
}
}


#' Find the index of the last comment in the sequence of comments-only tokens
#' after the token that has position `pos` in `pd`.
#' @param pd A parse table.
#' @param pos The position of the token to start the search from.
#' @keywords internal
extend_if_comment <- function(pd, pos) {
if (pos == nrow(pd)) {
return(pos)
}
if (pd$token[pos + 1L] == "COMMENT") {
extend_if_comment(pd, pos + 1L)
} else {
pos
}
}
19 changes: 0 additions & 19 deletions man/extend_if_comment.Rd

This file was deleted.

5 changes: 0 additions & 5 deletions tests/testthat/test-helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,3 @@ test_that("can lookup tokens", {
lookup_new_special()
})
})

test_that("can extend non-comment", {
pd <- compute_parse_data_nested(c("if (TRUE) # \n call(34)"))
expect_equal(extend_if_comment(pd$child[[1]], 4), 5)
})
Loading