File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -2379,6 +2379,38 @@ function(x, ...)
23792379 res
23802380}
23812381
2382+ # ## Additional functions for checkS3methods
2383+ checkTopLevelCall <- function (expr , fun_name ) {
2384+ if (inherits(expr , " if" ) || ! is.call(expr )) {
2385+ return (FALSE )
2386+ }
2387+ fun_name <- as.name(fun_name )
2388+ fun_called <- expr [[1 ]]
2389+ if (is.call(fun_called )) {
2390+ inner_called <- fun_called [[1 ]]
2391+ if (as.character(inner_called ) %in% c(" :::" , " ::" )) {
2392+ fun_called <- fun_called [[3 ]]
2393+ }
2394+ }
2395+ identical(fun_called , fun_name )
2396+ }
2397+
2398+ containsTopLevelCall <- function (x , fun_name ) {
2399+ fun_body <- body(x )
2400+ if (inherits(fun_body , " {" )) {
2401+ any(vapply(fun_body , checkTopLevelCall , TRUE , fun = fun_name ))
2402+ } else {
2403+ checkTopLevelCall(fun_body , fun_name )
2404+ }
2405+ }
2406+
2407+ isDeprecated <- function (fun ) {
2408+ containsTopLevelCall(fun , quote(.Deprecated ))
2409+ }
2410+ isDefunct <- function (fun ) {
2411+ containsTopLevelCall(fun , quote(.Defunct ))
2412+ }
2413+
23822414# ## * checkS3methods
23832415
23842416checkS3methods <-
You can’t perform that action at this time.
0 commit comments