Skip to content
Snippets Groups Projects
Commit 9fc54653 authored by Mick Jordan's avatar Mick Jordan
Browse files

new.env as .Internal

parent c1bae2ff
No related branches found
No related tags found
No related merge requests found
......@@ -235,7 +235,7 @@ public class EnvFunctions {
}
}
@RBuiltin(name = "new.env", kind = SUBSTITUTE)
@RBuiltin(name = "new.env", kind = INTERNAL)
// TOOD INTERNAL
public abstract static class NewEnv extends RBuiltinNode {
......@@ -246,30 +246,19 @@ public class EnvFunctions {
return PARAMETER_NAMES;
}
@Override
public RNode[] getParameterValues() {
return new RNode[]{ConstantNode.create(RRuntime.LOGICAL_TRUE), ConstantNode.create(RMissing.instance), ConstantNode.create(29)};
}
@CreateCast("arguments")
protected RNode[] castStatusArgument(RNode[] arguments) {
// size argument is at index 2, and an int
arguments[2] = CastIntegerNodeFactory.create(arguments[2], true, false, false);
return arguments;
}
@Specialization
@SuppressWarnings("unused")
public REnvironment newEnv(VirtualFrame frame, byte hash, RMissing parent, int size) {
public REnvironment newEnv(VirtualFrame frame, byte hash, RNull parent, int size) {
// TODO this will eventually go away when R code fixed when promises available
controlVisibility();
// FIXME don't ignore hash parameter
// FIXME what if hash == FALSE?
return new REnvironment.NewEnv(frameToEnvironment(frame), size);
}
@Specialization
public REnvironment newEnv(@SuppressWarnings("unused") VirtualFrame frame, @SuppressWarnings("unused") byte hash, REnvironment parent, int size) {
controlVisibility();
// FIXME don't ignore hash parameter
// FIXME what if hash == FALSE?
return new REnvironment.NewEnv(parent, size);
}
}
......
......@@ -37,9 +37,10 @@ eval.parent <- function(expr, n = 1) {
# is.pairlist(envir)) parent.frame() else baseenv())
# .Internal(eval(substitute(expr), envir, enclos))
# currently implemented as a direct builtin
# slightly customized to avoid lack of promises
#new.env <- function (hash = TRUE, parent = parent.frame(), size = 29L)
# .Internal(new.env(hash, parent, size))
new.env <- function (hash = TRUE, parent = NULL, size = 29L)
.Internal(new.env(hash, parent, size))
parent.env <- function(env)
.Internal(parent.env(env))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment