Skip to content
Snippets Groups Projects
Commit dcee6685 authored by Lukas Stadler's avatar Lukas Stadler
Browse files

allow Rf_eval in emptyenv

parent 6895d320
No related branches found
No related tags found
No related merge requests found
......@@ -141,7 +141,11 @@ public abstract class RfEvalNode extends FFIUpCallNode.Arg2 {
if (envIsNullProfile.profile(envArg == RNull.instance)) {
return REnvironment.globalEnv(RContext.getInstance());
} else if (envArg instanceof REnvironment) {
return (REnvironment) envArg;
REnvironment env = (REnvironment) envArg;
if (env == REnvironment.emptyEnv()) {
return RContext.getInstance().stateREnvironment.getEmptyDummy();
}
return env;
}
CompilerDirectives.transferToInterpreter();
throw RError.error(RError.NO_CALLER, ARGUMENT_NOT_ENVIRONMENT);
......
......@@ -124,8 +124,12 @@ public abstract class REnvironment extends RAttributeStorage {
@CompilationFinal private SearchPath searchPath;
@CompilationFinal private MaterializedFrame parentGlobalFrame; // SHARED_PARENT_RW only
@CompilationFinal private REnvironment emptyDummy; // used when evaluating in emptyenv
private ContextStateImpl(MaterializedFrame globalFrame) {
this.globalFrame = globalFrame;
this.emptyDummy = RDataFactory.createNewEnv(null, false, 0);
RArguments.initializeEnclosingFrame(this.emptyDummy.getFrame(), null);
}
public REnvironment getGlobalEnv() {
......@@ -144,6 +148,10 @@ public abstract class REnvironment extends RAttributeStorage {
return baseEnv;
}
public REnvironment getEmptyDummy() {
return emptyDummy;
}
public REnvironment getBaseNamespace() {
return baseEnv.getNamespace();
}
......
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