Skip to content

Commit f22c85d

Browse files
committed
Add attribute to versions
1 parent a3900e4 commit f22c85d

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/library/base/R/version.R

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,11 @@ function(x, strict = TRUE)
118118
if(is.list(x) && all(c("major", "minor") %in% names(x)))
119119
return(R_system_version(paste(x[c("major", "minor")],
120120
collapse = ".")))
121-
.make_numeric_version(x, strict,
121+
version <- .make_numeric_version(x, strict,
122122
.standard_regexps()$valid_package_version,
123123
"package_version")
124+
attr(version, "source") <- x
125+
version
124126
}
125127

126128
is.package_version <-
@@ -358,12 +360,7 @@ function(x, incomparables = FALSE, ...)
358360
format.numeric_version <-
359361
function(x, ...)
360362
{
361-
x <- unclass(x)
362-
y <- rep.int(NA_character_, length(x))
363-
names(y) <- names(x)
364-
ind <- lengths(x) > 0L
365-
y[ind] <- unlist(lapply(x[ind], paste, collapse = "."))
366-
y
363+
attr(x, "source")
367364
}
368365

369366
is.na.numeric_version <-

0 commit comments

Comments
 (0)