import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
-import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.simantics.scl.compiler.module.repository.ImportFailure;
import org.simantics.scl.compiler.module.repository.ImportFailureException;
import org.simantics.scl.compiler.module.repository.ModuleRepository;
+import org.simantics.scl.compiler.module.repository.UpdateListener;
import org.simantics.scl.compiler.runtime.RuntimeEnvironment;
import org.simantics.scl.compiler.top.ExpressionEvaluator;
import org.simantics.scl.compiler.top.LocalStorage;
THashMap<String,Type> variableTypes = new THashMap<String,Type>();
PrintStream fileOutput;
+ private UpdateListener dependenciesListener;
/**
* Only checks the commands for compilation errors but does not run them.
runtimeEnvironment = null;
try {
+ if(dependenciesListener != null)
+ dependenciesListener.stopListening();
try {
runtimeEnvironment = moduleRepository.createRuntimeEnvironment(
environmentSpecification,
- getClass().getClassLoader());
+ getClass().getClassLoader(),
+ dependenciesListener);
} catch(ImportFailureException e) {
THashSet<String> failedModules = new THashSet<String>();
for(ImportFailure failure : e.failures) {
try {
runtimeEnvironment = moduleRepository.createRuntimeEnvironment(
environmentSpecification,
- getClass().getClassLoader());
+ getClass().getClassLoader()); // no listener here, because should listen also failed modules
} catch (ImportFailureException e1) {
for(ImportFailure failure : e1.failures)
defaultHandler.printError(failure.toString());
void finishBlock() {
if(currentBlock != null) {
checkInterrupted();
- LinkedList<Statement> statements = currentBlock.getStatements();
currentBlock.location = Locations.combine(
- statements.getFirst().location,
- statements.getLast().location);
+ currentBlock.getFirst().location,
+ currentBlock.getLast().location);
execute(reader, currentBlock, handler);
currentBlock = null;
}
return validate(new StringReader(command));
}
+ public void setDependenciesListener(UpdateListener dependenciesListener) {
+ this.dependenciesListener = dependenciesListener;
+ }
}