The R Project SVN R

Rev

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

Rev 31672 Rev 31685
Line 337... Line 337...
337
/* "usemethod". Things like [ and [[ call usemethod directly, */
337
/* "usemethod". Things like [ and [[ call usemethod directly, */
338
/* hence do_usemethod should just be an interface to usemethod. */
338
/* hence do_usemethod should just be an interface to usemethod. */
339
 
339
 
340
SEXP do_usemethod(SEXP call, SEXP op, SEXP args, SEXP env)
340
SEXP do_usemethod(SEXP call, SEXP op, SEXP args, SEXP env)
341
{
341
{
342
    SEXP ans, generic, obj;
342
    SEXP ans, generic = R_NilValue /* -Wall */, obj;
343
    SEXP callenv, defenv;
343
    SEXP callenv, defenv;
344
    int nargs;
344
    int nargs;
345
    RCNTXT *cptr;
345
    RCNTXT *cptr;
346
 
346
 
347
    nargs = length(args);
347
    nargs = length(args);
Line 359... Line 359...
359
    defenv = TYPEOF(env) == ENVSXP ? ENCLOS(env) : R_NilValue;
359
    defenv = TYPEOF(env) == ENVSXP ? ENCLOS(env) : R_NilValue;
360
 
360
 
361
    if (nargs)
361
    if (nargs)
362
	PROTECT(generic = eval(CAR(args), env));
362
	PROTECT(generic = eval(CAR(args), env));
363
    else 
363
    else 
364
	errorcall(call, "there must be a first argument");
364
	errorcall(call, "There must be a first argument");
365
 
365
 
366
    if (nargs > 2)  /* R-lang says there should be a warning */
366
    if (nargs > 2)  /* R-lang says there should be a warning */
367
	warningcall(call, "Arguments after the first two are ignored");
367
	warningcall(call, "Arguments after the first two are ignored");
368
    if (nargs >= 2)
368
    if (nargs >= 2)
369
	PROTECT(obj = eval(CADR(args), env));
369
	PROTECT(obj = eval(CADR(args), env));