The R Project SVN R

Rev

Rev 63181 | Rev 64933 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 63181 Rev 63223
Line 416... Line 416...
416
       }
416
       }
417
 
417
 
418
	The generic need not be a closure (Henrik Bengtsson writes
418
	The generic need not be a closure (Henrik Bengtsson writes
419
	UseMethod("$"), although only functions are documented.)
419
	UseMethod("$"), although only functions are documented.)
420
    */
420
    */
421
    val = findVar1(install(translateChar(STRING_ELT(generic, 0))),
421
    val = findVar1(installTrChar(STRING_ELT(generic, 0)),
422
		   ENCLOS(env), FUNSXP, TRUE); /* That has evaluated promises */
422
		   ENCLOS(env), FUNSXP, TRUE); /* That has evaluated promises */
423
    if(TYPEOF(val) == CLOSXP) defenv = CLOENV(val);
423
    if(TYPEOF(val) == CLOSXP) defenv = CLOENV(val);
424
    else defenv = R_BaseNamespace;
424
    else defenv = R_BaseNamespace;
425
 
425
 
426
    if (CADR(argList) != R_MissingArg)
426
    if (CADR(argList) != R_MissingArg)
Line 1081... Line 1081...
1081
{
1081
{
1082
    /* dispatch the non-generic definition of `name'.  Used to trap
1082
    /* dispatch the non-generic definition of `name'.  Used to trap
1083
       calls to standardGeneric during the loading of the methods package */
1083
       calls to standardGeneric during the loading of the methods package */
1084
    SEXP e, value, rho, fun, symbol;
1084
    SEXP e, value, rho, fun, symbol;
1085
    RCNTXT *cptr;
1085
    RCNTXT *cptr;
1086
    const void *vmax = vmaxget();
-
 
1087
 
1086
 
1088
    /* find a non-generic function */
1087
    /* find a non-generic function */
1089
    symbol = install(translateChar(asChar(name)));
1088
    symbol = installTrChar(asChar(name));
1090
    for(rho = ENCLOS(env); rho != R_EmptyEnv;
1089
    for(rho = ENCLOS(env); rho != R_EmptyEnv;
1091
	rho = ENCLOS(rho)) {
1090
	rho = ENCLOS(rho)) {
1092
	fun = findVarInFrame3(rho, symbol, TRUE);
1091
	fun = findVarInFrame3(rho, symbol, TRUE);
1093
	if(fun == R_UnboundValue) continue;
1092
	if(fun == R_UnboundValue) continue;
1094
	switch(TYPEOF(fun)) {
1093
	switch(TYPEOF(fun)) {
Line 1119... Line 1118...
1119
    SETCAR(e, fun);
1118
    SETCAR(e, fun);
1120
    /* evaluate a call the non-generic with the same arguments and from
1119
    /* evaluate a call the non-generic with the same arguments and from
1121
       the same environment as the call to the generic version */
1120
       the same environment as the call to the generic version */
1122
    value = eval(e, cptr->sysparent);
1121
    value = eval(e, cptr->sysparent);
1123
    UNPROTECT(1);
1122
    UNPROTECT(1);
1124
    vmaxset(vmax);
-
 
1125
    return value;
1123
    return value;
1126
}
1124
}
1127
 
1125
 
1128
 
1126
 
1129
static SEXP get_this_generic(SEXP args);
1127
static SEXP get_this_generic(SEXP args);