use of org.eclipse.ceylon.compiler.typechecker.tree.Tree.ImportModule in project ceylon by eclipse.
the class ModuleValidator method verifyNative.
private void verifyNative(Module module) {
for (ImportModule imp : moduleManagerUtil.retrieveModuleImportNodes(module)) {
Module importedModule;
Node node;
if (imp.getImportPath() != null) {
node = imp.getImportPath();
importedModule = (Module) imp.getImportPath().getModel();
} else {
node = imp.getQuotedLiteral();
importedModule = moduleManagerUtil.getModuleForNode(node);
if (importedModule == null)
continue;
}
Backends bs = getNativeBackend(imp.getAnnotationList(), imp.getUnit());
if (bs.none()) {
if (importedModule.isNative() && !module.isNative()) {
node.addError(new ModuleSourceMapper.ModuleDependencyAnalysisError(node, "native import for cross-platform module" + " (mark either the module or the import as native)", 20000));
}
} else if (importedModule.isNative() && !bs.supports(importedModule.getNativeBackends())) {
node.addError(new ModuleSourceMapper.ModuleDependencyAnalysisError(node, "native backend name conflicts with imported module: '\"" + bs + "\"' is not '\"" + importedModule.getNativeBackends().names() + "\"'"));
}
}
}
Aggregations