Skip to content

Commit

Permalink
Renamed not_found => rsc_not_found
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulKlint committed Sep 21, 2024
1 parent 3767eba commit acb1999
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ void checkSupportedByParserGenerator(Tree t, Collector c){
}

data MStatus =
not_found()
rsc_not_found()
| tpl_not_found()
| parsed()
| parse_error()
| module_dependencies_extracted()
Expand Down Expand Up @@ -138,11 +139,13 @@ tuple[bool, Module, ModuleStatus] getModuleParseTree(str qualifiedModuleName, Mo
mloc = |unknown:///<qualifiedModuleName>|;
try {
mloc = getModuleLocation(qualifiedModuleName, pcfg);
// Make sure we found a real source module (as opposed to a tpl module in a library
if(mloc.extension != "rsc") throw "";
// Make sure we found a real source module (as opposed to a tpl module in a library
if(mloc.extension != "rsc") {
ms.status[qualifiedModuleName] += {rsc_not_found()};
throw "";
}
} catch _: {
//ms.messages[qualifiedModuleName] ? [] = [error("Module <qualifiedModuleName> not found", mloc)];
//ms.status[qualifiedModuleName] += {not_found()};
mpt = [Module] "module <qualifiedModuleName>";
//ms.parseTrees[qualifiedModuleName] = mpt;
ms.moduleLocs[qualifiedModuleName] = mloc;
Expand Down Expand Up @@ -258,7 +261,7 @@ tuple[bool, TModel, ModuleStatus] getTModelForModule(str qualifiedModuleName, Mo
// //return <true, tpl, ms>;
//}
} catch e: {
//ms.status[qualifiedModuleName] ? {} += not_found();
//ms.status[qualifiedModuleName] ? {} += rsc_not_found();
return <false, tmodel(modelName=qualifiedModuleName, messages=[error("Cannot read TPL for <qualifiedModuleName>: <e>", tplLoc)]), ms>;
//throw IO("Cannot read tpl for <qualifiedModuleName>: <e>");
}
Expand All @@ -269,7 +272,7 @@ tuple[bool, TModel, ModuleStatus] getTModelForModule(str qualifiedModuleName, Mo
//if(qualifiedModuleName notin hardwired){
// ms.tmodelLIFO = ms.tmodelLIFO[1..];
//}
//ms.status[qualifiedModuleName] ? {} += not_found();
//ms.status[qualifiedModuleName] ? {} += rsc_not_found();
return <false, tmodel(modelName=qualifiedModuleName, messages=[error("Cannot read TPL for <qualifiedModuleName>", |unknown:///<qualifiedModuleName>|)]), ms>;
// throw IO("Cannot read tpl for <qualifiedModuleName>");
}
18 changes: 9 additions & 9 deletions src/org/rascalmpl/core/library/lang/rascalcore/check/Import.rsc
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,13 @@ ModuleStatus getImportAndExtendGraph(str qualifiedModuleName, ModuleStatus ms){
if(success){
<ms, imports_and_extends> = getModulePathsAsStr(pt, ms);

for(<_, kind, imp> <- imports_and_extends, not_found() notin ms.status[imp]){
for(<_, kind, imp> <- imports_and_extends, rsc_not_found() notin ms.status[imp]){
ms.strPaths += {<qualifiedModuleName, kind, imp>};
ms = getImportAndExtendGraph(imp, ms);
}
} else {
if(not_found() notin ms.status[qualifiedModuleName]){
ms.status[qualifiedModuleName] += not_found();
if(rsc_not_found() notin ms.status[qualifiedModuleName]){
ms.status[qualifiedModuleName] += rsc_not_found();
}
}

Expand Down Expand Up @@ -220,7 +220,7 @@ tuple[ModuleStatus, rel[str, PathRole, str]] getModulePathsAsStr(Module m, Modul
getModuleLocation(iname, ms.pathConfig);
} catch str msg: {
ms.messages[moduleName] ? [] += [ error(msg, imod@\loc) ];
ms.status[iname] += { not_found() };
ms.status[iname] += { rsc_not_found() };
}
}
ms.strPaths += imports_and_extends;
Expand Down Expand Up @@ -249,15 +249,15 @@ tuple[map[str,TModel], ModuleStatus] prepareForCompilation(set[str] component, m
pcfg = ms.pathConfig;

dependencies_ok = true;
for(m <- component, not_found() notin ms.status[m], MStatus::ignored() notin ms.status[m]){
for(m <- component, rsc_not_found() notin ms.status[m], MStatus::ignored() notin ms.status[m]){
if(parse_error() in ms.status[m]){
return <(m : tmodel(modelName=m,messages=ms.messages[m])) ,ms>;
}
for(imp <- m_imports[m] + m_extends[m], not_found() notin ms.status[imp], MStatus::ignored() notin ms.status[m]){
for(imp <- m_imports[m] + m_extends[m], rsc_not_found() notin ms.status[imp], MStatus::ignored() notin ms.status[m]){
imp_status = ms.status[imp];
if(parse_error() in imp_status || checked() notin imp_status){
dependencies_ok = false;
cause = (not_found() in imp_status) ? "module not found" : "due to syntax error";
cause = (rsc_not_found() in imp_status) ? "module not found" : "due to syntax error";
ms.messages[m] = (ms.messages[imp] ? []) + error("<imp in m_imports[imp] ? "Imported" : "Extended"> module <imp> could not be checked (<cause>)", moduleScopes[m]);
}
}
Expand All @@ -267,7 +267,7 @@ tuple[map[str,TModel], ModuleStatus] prepareForCompilation(set[str] component, m
}
transient_tms = (m : tm | m <- component);
org_tm = tm;
for(m <- component, not_found() notin ms.status[m], MStatus::ignored() notin ms.status[m]){
for(m <- component, rsc_not_found() notin ms.status[m], MStatus::ignored() notin ms.status[m]){
tm = org_tm;
tm.modelName = m;
mScope = getModuleScope(m, moduleScopes, pcfg);
Expand All @@ -288,7 +288,7 @@ ModuleStatus doSaveModule(set[str] component, map[str,set[str]] m_imports, map[s
pcfg = ms.pathConfig;

start_save = cpuTime();
if(any(c <- component, !isEmpty({parse_error(), not_found(), MStatus::ignored()} & ms.status[c]))){
if(any(c <- component, !isEmpty({parse_error(), rsc_not_found(), MStatus::ignored()} & ms.status[c]))){
return ms;
}
if(any(c <- component, error(_,_) <- ms.messages[c])){
Expand Down

0 comments on commit acb1999

Please sign in to comment.