try {
String absoluteModuleName = ModuleUtils.resolveAbsolutePath(moduleName, relativeImport.moduleName);
ImportDeclaration absoluteImport = new ImportDeclaration(
+ relativeImport.location,
absoluteModuleName, relativeImport.localName,
relativeImport.reexport, relativeImport.spec);
- absoluteImport.location = relativeImport.location;
absoluteImports.add(absoluteImport);
} catch (InvalidModulePathException e) {
errorLog.log(relativeImport.location, e.getMessage());
this.spec = DEFAULT_SPEC;
}
+ public ImportDeclaration(long location, String moduleName, String localName, boolean reexport, ImportSpec spec) {
+ this(moduleName, localName, reexport);
+ this.location = location;
+ }
+
public ImportDeclaration(String moduleName, String localName, boolean reexport, ImportSpec spec) {
if(spec == null)
throw new NullPointerException();
import org.simantics.scl.compiler.errors.DoesNotExist;
import org.simantics.scl.compiler.errors.Failable;
import org.simantics.scl.compiler.errors.Failure;
+import org.simantics.scl.compiler.errors.Locations;
import org.simantics.scl.compiler.errors.Success;
import org.simantics.scl.compiler.module.ImportDeclaration;
import org.simantics.scl.compiler.module.Module;
import org.simantics.scl.compiler.types.Types;
import gnu.trove.map.hash.THashMap;
+import gnu.trove.map.hash.TObjectLongHashMap;
import gnu.trove.procedure.TObjectObjectProcedure;
import gnu.trove.set.hash.THashSet;
THashMap<String, ModuleEntry> result = new THashMap<String, ModuleEntry>();
Collection<ImportFailure> failures = null;
- THashSet<String> originalImports = new THashSet<String>();
+ TObjectLongHashMap<String> originalImports = new TObjectLongHashMap<String>();
ArrayList<ImportDeclaration> stack = new ArrayList<ImportDeclaration>(imports.length);
for(ImportDeclaration import_ : imports) {
stack.add(import_);
- originalImports.add(import_.moduleName);
+ originalImports.put(import_.moduleName, import_.location);
}
while(!stack.isEmpty()) {
ImportDeclaration import_ = stack.remove(stack.size()-1);
stack.addAll(compilationResult.getResult().getDependencies());
if(originalImport) {
String deprecation = compilationResult.getResult().getDeprecation();
- if(deprecation != null && compilationContext != null)
- compilationContext.errorLog.logWarning(import_.location, "Deprecated module " + import_.moduleName + (deprecation.isEmpty() ? "." : ": " + deprecation));
+ if(deprecation != null && compilationContext != null) {
+ long location = originalImport ? originalImports.get(import_.moduleName) : Locations.NO_LOCATION;
+ compilationContext.errorLog.logWarning(location, "Deprecated module " + import_.moduleName + (deprecation.isEmpty() ? "." : ": " + deprecation));
+ }
}
}
else {