Commit d5a54376 authored by Radford Neal's avatar Radford Neal

added (currently unused) VARIANT_MISSING_OK, and fixed a bug

parent 1316520d
Implements '_' as an explicit missing value, and its
use to signal that a diminsion should not be dropped
with '[ ]'.
Fixed following bug (also in R-3.3.0):
> f <- function (...) ..2
> f(1,,2)
> g <- function (a,b,c) b
> g(1,,2)
Error in g(1, , 2) : argument "b" is missing, with no default
Call of f should also produce an error.
......@@ -577,7 +577,7 @@ typedef struct {
also sets R_variant_result to 1 or 2 if
the result is an unshared subset of
the first argument. If set to 2, any
change still must be propaged upwards. */
change still must be propagated upwards*/
/* Variant flags that are passed on. */
......@@ -602,7 +602,9 @@ typedef struct {
/* Variant flags that are not passed on. */
/* none so far */
#define VARIANT_MISSING_OK 0x10000 /* A missing value will be returned as
R_MissingArg, rather than producing an
error. Does not set R_variant_result. */
/* Flags in R_variant_result. */
......
......@@ -530,17 +530,15 @@ SEXP attribute_hidden Rf_evalv2(SEXP e, SEXP rho, int variant)
if (e == R_DotsSymbol)
dotdotdot_error();
if (DDVAL(e))
res = ddfindVar(e,rho);
else {
res = FIND_VAR_PENDING_OK (e, rho);
if (res == R_MissingArg)
arg_missing_error(e);
}
res = DDVAL(e) ? ddfindVar(e,rho) : FIND_VAR_PENDING_OK (e, rho);
if (res == R_UnboundValue)
unbound_var_error(e);
if (TYPEOF(res) == PROMSXP) {
else if (res == R_MissingArg) {
if ( ! (variant & VARIANT_MISSING_OK))
arg_missing_error(e);
}
else if (TYPEOF(res) == PROMSXP) {
if (PRVALUE_PENDING_OK(res) == R_UnboundValue)
res = forcePromiseUnbound(res);
else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment