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/exceptions/RascalStackOverflowError.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public Throw makeThrow() {
Environment env = deepestEnvironment;

while (env != null) {
trace.add(env.getLocation(), env.getName());
trace.add(env.getCreatorLocation(), env.getName());
env = env.getCallerScope();
}

Expand Down
32 changes: 23 additions & 9 deletions src/org/rascalmpl/interpreter/Evaluator.java
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ public IValue main(IRascalMonitor monitor, String module, String function, Strin
ModuleEnvironment modEnv = getHeap().getModule(module);
setCurrentEnvt(modEnv);

Name name = Names.toName(function, modEnv.getLocation());
Name name = Names.toName(function, modEnv.getCreatorLocation());

Result<IValue> func = getCurrentEnvt().getVariable(name);

Expand Down Expand Up @@ -633,7 +633,7 @@ public IValue main(IRascalMonitor monitor, String module, String function, Map<S
ModuleEnvironment modEnv = getHeap().getModule(module);
setCurrentEnvt(modEnv);

Name name = Names.toName(function, modEnv.getLocation());
Name name = Names.toName(function, modEnv.getCreatorLocation());

Result<IValue> func = getCurrentEnvt().getVariable(name);

Expand Down Expand Up @@ -690,7 +690,7 @@ public IValue call(String name, String module, Map<String, IValue> kwArgs, IValu
}

private IValue call(String name, Map<String,IValue> kwArgs, IValue... args) {
QualifiedName qualifiedName = Names.toQualifiedName(name, getCurrentEnvt().getLocation());
QualifiedName qualifiedName = Names.toQualifiedName(name, getCurrentEnvt().getCreatorLocation());
setCurrentAST(qualifiedName);
return call(qualifiedName, kwArgs, args);
}
Expand Down Expand Up @@ -807,7 +807,7 @@ public StackTrace getStackTrace() {
StackTrace trace = new StackTrace();
Environment env = currentEnvt;
while (env != null) {
trace.add(env.getLocation(), env.getName());
trace.add(env.getCreatorLocation(), env.getName());
env = env.getCallerScope();
}
return trace.freeze();
Expand Down Expand Up @@ -1174,13 +1174,27 @@ private void reloadModules(IRascalMonitor monitor, Set<String> names, ISourceLoc

for (String mod : names) {
if (heap.existsModule(mod)) {
onHeap.add(mod);
var uri = heap.getModuleURI(mod);
assert uri != null : "guaranteed by Import::loadModule";

if (resolverRegistry.exists(vf.sourceLocation(uri))) {
// otherwise the file has been renamed or deleted, and we do
// not add it to the todo list.
onHeap.add(mod);
}

if (recurseToExtending) {
// even if a module was renamed, or deleted, the modules that were
// previously extending it have to be re-evaluated.
extendingModules.addAll(heap.getExtendingModules(mod));
}

// this module starts with a clean slate
heap.removeModule(heap.getModule(mod));
}
}

// all extending modules start with a clean slate too.
extendingModules.removeAll(names);

job(LOADING_JOB_CONSTANT, onHeap.size(), (jobName, step) -> {
Expand Down Expand Up @@ -1222,7 +1236,7 @@ private void reloadModules(IRascalMonitor monitor, Set<String> names, ISourceLoc
affectedModules.add(mod);
}
else {
warning("could not reimport " + imp, errorLocation);
warning("File of previously imported module " + imp + " is not available anymore.", errorLocation);
}
}
}
Expand All @@ -1240,7 +1254,7 @@ private void reloadModules(IRascalMonitor monitor, Set<String> names, ISourceLoc
env.addExtend(ext);
}
else {
warning("could not re-extend " + ext, errorLocation);
warning("File of previously extended module " + ext + " is not available anymore.", errorLocation);
}
}
}
Expand Down Expand Up @@ -1326,7 +1340,7 @@ public void pushEnv() {
}

private ISourceLocation getCurrentLocation() {
return currentAST != null ? currentAST.getLocation() : getCurrentEnvt().getLocation();
return currentAST != null ? currentAST.getLocation() : getCurrentEnvt().getCreatorLocation();
}

@Override
Expand Down Expand Up @@ -1774,7 +1788,7 @@ public IRascalFrame getTopFrame() {
@Override
public ISourceLocation getCurrentPointOfExecution() {
AbstractAST cpe = getCurrentAST();
return cpe != null ? cpe.getLocation() : getCurrentEnvt().getLocation();
return cpe != null ? cpe.getLocation() : getCurrentEnvt().getCreatorLocation();
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/org/rascalmpl/interpreter/env/Environment.java
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public String getName() {
/**
* @return the location where this environment was created (i.e. call site) for use in tracing
*/
public ISourceLocation getLocation() {
public ISourceLocation getCreatorLocation() {
return loc;
}

Expand Down
2 changes: 0 additions & 2 deletions src/org/rascalmpl/interpreter/env/GlobalEnvironment.java
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,9 @@ public ModuleEnvironment getModule(QualifiedName name, AbstractAST ast) {
return module;
}


public boolean existsModule(String name) {
return moduleEnvironment.containsKey(name);
}


@Override
public String toString(){
Expand Down
2 changes: 1 addition & 1 deletion src/org/rascalmpl/interpreter/result/AbstractFunction.java
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ protected Type bindTypeParameters(Type actualStaticTypes, IValue[] actuals, Type
if (actualStaticTypes.isOpen()) {
// we have to make the environment hygenic now, because the caller scope
// may have the same type variable names as the current scope
actualStaticTypes = renameType(actualStaticTypes, renamings, env.getLocation());
actualStaticTypes = renameType(actualStaticTypes, renamings, env.getCreatorLocation());
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public Result<IValue> computeDefaultKeywordParameter(String label, IConstructor
Set<GenericKeywordParameters> kws = callerEnvironment.lookupGenericKeywordParameters(constructorType.getAbstractDataType());
IWithKeywordParameters<? extends IConstructor> wkw = value.asWithKeywordParameters();
Environment old = ctx.getCurrentEnvt();
Environment resultEnv = new Environment(declarationEnvironment, callerEnvironment, callerEnvironment.getLocation(), URIUtil.rootLocation("initializer"), "keyword parameter initializer");
Environment resultEnv = new Environment(declarationEnvironment, callerEnvironment, callerEnvironment.getCreatorLocation(), URIUtil.rootLocation("initializer"), "keyword parameter initializer");

// first we compute the keyword parameters for the abstract data-type:
for (GenericKeywordParameters gkw : kws) {
Expand Down
2 changes: 1 addition & 1 deletion src/org/rascalmpl/interpreter/result/JavaMethod.java
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ private Map<Type, Type> fastBindTypeParameters(Type[] actualStaticTypes, IValue[
// we have to make the environment hygenic now, because the caller scope
// may have the same type variable names as the current scope
renamings = new HashMap<>();
actualStaticTypes = fastRenameType(actualStaticTypes, renamings, env.getLocation());
actualStaticTypes = fastRenameType(actualStaticTypes, renamings, env.getCreatorLocation());
}
else {
renamings = Collections.emptyMap();
Expand Down
6 changes: 3 additions & 3 deletions src/org/rascalmpl/interpreter/utils/Profiler.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ public void run(){
env = env.getParent();
}
if (env != null) {
Count currentCount = frame.get(env.getLocation());
Count currentCount = frame.get(env.getCreatorLocation());
if (currentCount == null) {
frame.put(env.getLocation(), new Count());
names.put(env.getLocation(), env.getName());
frame.put(env.getCreatorLocation(), new Count());
names.put(env.getCreatorLocation(), env.getName());
}
else {
currentCount.increment();
Expand Down
2 changes: 1 addition & 1 deletion src/org/rascalmpl/semantics/dynamic/Import.java
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ else if (reg.exists(parserCacheFile)) {
}
}
catch (URISyntaxException | ClassNotFoundException | IOException e) {
eval.warning("reusing parsers failed during module import: " + e.getMessage(), env.getLocation());
eval.warning("reusing parsers failed during module import: " + e.getMessage(), env.getCreatorLocation());
}

return result;
Expand Down
Loading