Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/org/rascalmpl/interpreter/TestEvaluator.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ private void runTests(ModuleEnvironment env, List<AbstractFunction> tests) {
// TODO: add bound type parameters
return new UnExpectedExceptionThrownResult(test.getEnv().getName() + "::" + test.getName(), actuals, Map.of(), args, e);
}
}, env.getRoot().getStore(), tries, maxDepth, maxWidth, typesConfig);
}, env.getStore(), tries, maxDepth, maxWidth, typesConfig);

eval.getOutPrinter().flush();
eval.getErrorPrinter().flush();
Expand Down
16 changes: 1 addition & 15 deletions src/org/rascalmpl/interpreter/env/Environment.java
Original file line number Diff line number Diff line change
Expand Up @@ -195,20 +195,6 @@ public Environment(Environment parent, Environment callerScope, ISourceLocation
}
}

protected Environment(Environment old) {
this.parent = old.parent;
this.loc = old.loc;
this.name = old.name;
this.callerScope = old.callerScope;
this.callerLocation = old.callerLocation;
this.variableEnvironment = old.variableEnvironment;
this.functionEnvironment = old.functionEnvironment;
this.staticTypeParameters = old.staticTypeParameters;
this.dynamicTypeParameters = old.dynamicTypeParameters;
this.variableFlags = old.variableFlags;
this.functionFlags = old.functionFlags;
}

/**
* @return the name of this environment/stack frame for use in tracing
*/
Expand Down Expand Up @@ -1011,7 +997,7 @@ public Environment getCallerScope() {

public ISourceLocation getCallerLocation() {
if (callerLocation != null) {
return callerLocation;
return callerLocation;
} else if (parent != null) {
return parent.getCallerLocation();
}
Expand Down
43 changes: 11 additions & 32 deletions src/org/rascalmpl/interpreter/env/ModuleEnvironment.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,23 +70,23 @@
*
*/
public class ModuleEnvironment extends Environment {
protected final GlobalEnvironment heap;
private final GlobalEnvironment heap;
/** Map of imported modules to resolved ModuleEnvironments, will only be empty in case of a module was in a cycle or got reloaded and failed during the reload. use {@link #importedModulesResolved} to lazily resolve the modules. */
protected Map<String, Optional<ModuleEnvironment>> importedModules;
protected Set<String> extended;
protected TypeStore typeStore;
protected Set<IValue> productions;
protected Map<Type, List<KeywordFormal>> generalKeywordParameters;
protected Map<String, NonTerminalType> concreteSyntaxTypes;
private Map<String, Optional<ModuleEnvironment>> importedModules;
private Set<String> extended;
private TypeStore typeStore;
private Set<IValue> productions;
private Map<Type, List<KeywordFormal>> generalKeywordParameters;
private Map<String, NonTerminalType> concreteSyntaxTypes;
private boolean initialized;
private boolean syntaxDefined;
private boolean bootstrap;
private String deprecated;
protected Map<String, AbstractFunction> resourceImporters;
protected Map<Type, Set<GenericKeywordParameters>> cachedGeneralKeywordParameters;
protected Map<String, List<AbstractFunction>> cachedPublicFunctions;
private Map<String, AbstractFunction> resourceImporters;
private Map<Type, Set<GenericKeywordParameters>> cachedGeneralKeywordParameters;
private Map<String, List<AbstractFunction>> cachedPublicFunctions;

protected static final TypeFactory TF = TypeFactory.getInstance();
private static final TypeFactory TF = TypeFactory.getInstance();

public final static String SHELL_MODULE = "$";

Expand All @@ -105,27 +105,6 @@ public ModuleEnvironment(String name, GlobalEnvironment heap) {
this.cachedGeneralKeywordParameters = null;
this.cachedPublicFunctions = null;
}

/**
* This constructor creates a shallow copy of the given environment
*
* @param env
*/
protected ModuleEnvironment(ModuleEnvironment env) {
super(env);
this.heap = env.heap;
this.importedModules = env.importedModules;
this.concreteSyntaxTypes = env.concreteSyntaxTypes;
this.productions = env.productions;
this.typeStore = env.typeStore;
this.initialized = env.initialized;
this.syntaxDefined = env.syntaxDefined;
this.bootstrap = env.bootstrap;
this.resourceImporters = env.resourceImporters;
this.cachedGeneralKeywordParameters = null;
this.cachedPublicFunctions = null;
this.deprecated = env.deprecated;
}

@Override
public void reset() {
Expand Down