aspect CheckModuleDecls { //CU module access lookup checks public void ASTNode.checkModuleDecls() {} //This must be called before the CUs are rearranged by InsertModuleCUs public void CompilationUnit.checkModuleDecls() { if (getModuleDecl() != null && lookupModuleCUNoTransform() == null) { getModuleDecl().getModuleAccess().error("Module not found: " + getModuleDecl().getModuleAccess().getID()); } } public void ModuleCompilationUnit.checkModuleDecls() { if (getModuleDecl().hasExtends() && getHostProgram().lookupModuleCUNoTransform(getModuleDecl().getExtends()) == null) { String msg = "Module not found: " + getModuleDecl().getExtends().getID(); getModuleDecl().getExtends().error(msg); //need to do this since checkmodulecycles will fail if this does not work throw new jastadd.UnrecoverableSemanticError(msg); } for (ModuleAccess ma: getModuleDecl().getImplementsList()) { if (getHostProgram().lookupModuleCUNoTransform(ma) == null) { String msg = "Module not found: " + ma.getID(); ma.error(msg); throw new jastadd.UnrecoverableSemanticError(msg); } } if (getModuleDecl().getModuleAccess().getID().equals(Program.SUPERMODULE_KEYWORD)) { String msg = "Invalid module name " + getModuleDecl().getModuleAccess().getID(); error(msg); throw new jastadd.UnrecoverableSemanticError(msg); } } }