Skip to content

Commit

Permalink
more vestigial code from allowing R<3.6 (#2289)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelChirico authored Nov 16, 2023
1 parent 5674008 commit fa9e1bf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 22 deletions.
16 changes: 1 addition & 15 deletions R/get_source_expressions.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ get_source_expressions <- function(filename, lines = NULL) {
}

# Only regard explicit attribute terminal_newline=FALSE as FALSE and all other cases (e.g. NULL or TRUE) as TRUE.
# We don't use isFALSE since it is introduced in R 3.5.0.
terminal_newline <- !identical(attr(source_expression$lines, "terminal_newline", exact = TRUE), FALSE)
terminal_newline <- !isFALSE(attr(source_expression$lines, "terminal_newline", exact = TRUE))

e <- NULL
source_expression$lines <- extract_r_source(
Expand Down Expand Up @@ -493,19 +492,6 @@ get_source_expression <- function(source_expression, error = identity) {
error = error
)

# TODO: Remove when minimum R version is bumped to > 3.5
#
# This needs to be done twice to avoid a bug fixed in R 3.4.4
# https://bugs.r-project.org/bugzilla/show_bug.cgi?id=16041
parsed_content <- tryCatch(
parse(
text = source_expression$content,
srcfile = source_expression,
keep.source = TRUE
),
error = error
)

if (inherits(parsed_content, c("error", "lint"))) {
assign("e", parsed_content, envir = parent.frame())
parse_error <- TRUE
Expand Down
8 changes: 1 addition & 7 deletions R/namespace.R
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,7 @@ is_s3_generic <- function(fun) {

.base_s3_generics <- unique(c(
names(.knownS3Generics),
if (getRversion() >= "3.5.0") {
.S3_methods_table[, 1L]
} else {
# R < 3.5.0 doesn't provide .S3_methods_table
# fallback: search baseenv() for generic methods
imported_s3_generics(data.frame(pkg = "base", fun = ls(baseenv()), stringsAsFactors = FALSE))$fun
},
.S3_methods_table[, 1L],
# Contains S3 generic groups, see ?base::groupGeneric and src/library/base/R/zzz.R
ls(.GenericArgsEnv)
))

0 comments on commit fa9e1bf

Please sign in to comment.