Skip to content

Commit

Permalink
Some more methods corrections
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.r-project.org/R/branches/R-noNULLenv@33517 00db46b3-68df-0310-9c12-caf00c1e9a41
  • Loading branch information
murdoch committed Mar 7, 2005
1 parent 31a4c29 commit 9e8ade6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/library/methods/R/MethodsList.R
Expand Up @@ -161,7 +161,7 @@ MethodsListSelect <-
## is returned as the value. If matching fails, NULL is returned.
function(f, env,
mlist = NULL,
fEnv = if(is(fdef, "genericFunction")) environment(fdef) else NULL,
fEnv = if(is(fdef, "genericFunction")) environment(fdef) else baseenv(),
finalDefault = finalDefaultMethod(mlist, f),
evalArgs = TRUE,
useInherited = TRUE, ## supplied when evalArgs is FALSE
Expand Down
2 changes: 1 addition & 1 deletion src/library/methods/R/RClassUtils.R
Expand Up @@ -1512,7 +1512,7 @@ substituteFunctionArgs <- function(def, newArgs, args = formalArgs(def), silent
## find a generic function reference, using the package slot if present
## FIXME: this and .classEnv should be combined and implemented in C for speed
## They differ in that .classEnv uses the class metaname when it searches; i.e.,
## they use getClassDef and .getGeneric resp. Also, .getEnv returns NULL rather
## they use getClassDef and .getGeneric resp. Also, .getEnv returns baseenv() rather
## than generating an error if no generic found (so getGeneric can return gen'c for prim'ves)

.genEnv <- function(f, default = .requirePackage("methods")) {
Expand Down
4 changes: 2 additions & 2 deletions src/library/methods/R/RMethodUtils.R
Expand Up @@ -414,10 +414,10 @@ getGeneric <-
if(is.function(f) && is(f, "genericFunction"))
return(f)
value <- if(identical(where, baseenv()))
NULL
baseenv()
else
.getGeneric( f, as.environment(where))
if(is.null(value) && exists(f, "package:base", inherits = FALSE)) {
if(identical(value, baseenv()) && exists(f, "package:base", inherits = FALSE)) {
## check for primitives
baseDef <- get(f, "package:base")
if(is.primitive(baseDef)) {
Expand Down

0 comments on commit 9e8ade6

Please sign in to comment.