Skip to content

Commit

Permalink
started on making the verbose flag available on top
Browse files Browse the repository at this point in the history
  • Loading branch information
jurgenvinju committed Mar 8, 2024
1 parent 0b93a2c commit d22204c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -415,8 +415,8 @@ list[ModuleMessages] checkAll(loc root, PathConfig pcfg, CompilerConfig compiler

// ---- Convenience check function during development -------------------------

map[str, list[Message]] checkModules(list[str] moduleNames, TypePalConfig config, PathConfig pcfg) {
ModuleStatus ms = rascalTModelForNames(moduleNames, config, getRascalCompilerConfig(), dummy_compile1);
map[str, list[Message]] checkModules(list[str] moduleNames, TypePalConfig config, PathConfig pcfg, bool verbose=true) {
ModuleStatus ms = rascalTModelForNames(moduleNames, config, getRascalCompilerConfig()[verbose=verbose], dummy_compile1);
tmodels = ms.tmodels;
return (mname : tmodels[mname].messages | mname <- tmodels, !isEmpty(tmodels[mname].messages));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,17 @@ set[Message] getAllMessages(ModuleStatus r)
= { m | mname <- r.tmodels, m <- r.tmodels[mname].messages };


ModuleStatus checkStatements(str stmts, list[str] importedModules = [], list[str] initialDecls = []){
ModuleStatus checkStatements(str stmts, list[str] importedModules = [], list[str] initialDecls = [], bool verbose=true){
mloc = buildModule(stmts, importedModules=importedModules, initialDecls=initialDecls);
return rascalTModelForLocs([mloc], rascalTypePalConfig(rascalPathConfig=testingConfig()), getRascalCompilerConfig(), dummy_compile1);
return rascalTModelForLocs([mloc], rascalTypePalConfig(rascalPathConfig=testingConfig()), getRascalCompilerConfig()[verbose=verbose], dummy_compile1);
}

bool check(str stmts, list[str] expected, list[str] importedModules = [], list[str] initialDecls = []){
errors = getAllMessages(checkStatements(stmts, importedModules=importedModules, initialDecls=initialDecls));
println(errors);
bool verbose=false;
errors = getAllMessages(checkStatements(stmts, importedModules=importedModules, initialDecls=initialDecls, verbose=verbose));
if (verbose) {
println(errors);
}
for(eitem <- errors, str exp <- expected){
if(matches(eitem.msg, exp))
return true;
Expand Down

0 comments on commit d22204c

Please sign in to comment.