Commit 5d3be20f authored by Radford Neal's avatar Radford Neal

another tweak to forcePromise

parent 8e6310b3
...@@ -703,24 +703,26 @@ SEXP attribute_hidden forcePromiseUnbound (SEXP e, int variant) ...@@ -703,24 +703,26 @@ SEXP attribute_hidden forcePromiseUnbound (SEXP e, int variant)
SET_PRSEEN (e, 0); SET_PRSEEN (e, 0);
SET_PRVALUE_MACRO (e, val); SET_PRVALUE_MACRO (e, val);
}
if (val == R_MissingArg) { /* Attempt to mimic past behaviour... */ if (val == R_MissingArg) {
if ( ! (variant & VARIANT_MISSING_OK) && TYPEOF(PRCODE(e)) == SYMSXP
&& R_isMissing (PRCODE(e), PRENV(e)))
arg_missing_error(PRCODE(e));
}
else {
/* Set the environment to R_NilValue to allow GC to reclaim the /* Attempt to mimic past behaviour... */
promise environment (unless value is R_MissingArg); this is if ( ! (variant & VARIANT_MISSING_OK) && TYPEOF(PRCODE(e)) == SYMSXP
also useful for fancy games with delayedAssign() */ && R_isMissing (PRCODE(e), PRENV(e)))
arg_missing_error(PRCODE(e));
SET_PRENV_NIL(e); return val;
}
} }
INC_NAMEDCNT(val); INC_NAMEDCNT(val);
/* Set the environment to R_NilValue to allow GC to reclaim the
promise environment (unless value is R_MissingArg); this is
also useful for fancy games with delayedAssign() */
SET_PRENV_NIL(e);
return val; return val;
} }
......
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