Skip to content

Commit

Permalink
Changed keyword parameter rascalPathConfig to positional parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulKlint committed Mar 8, 2024
1 parent d22204c commit 104fe83
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 28 deletions.
2 changes: 1 addition & 1 deletion src/org/rascalmpl/core/library/CheckTestSources.rsc
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ tuple[str, int] safeCompile(str \module, PathConfig pcfg, CompilerConfig compil
try {
println("checking <\module>");
ModuleStatus result = rascalTModelForNames([\module],
rascalTypePalConfig(rascalPathConfig=pcfg),
rascalTypePalConfig(pcfg),
compilerConfig,
dummy_compile1);
iprintln(result.tmodels[\module].messages);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ tuple[set[str], ModuleStatus] loadImportsAndExtends(str moduleName, ModuleStatus
}

tuple[TModel, ModuleStatus] rascalTModelComponent(set[str] moduleNames, ModuleStatus ms,
TypePalConfig config=rascalTypePalConfig(rascalPathConfig=ms.pathConfig), bool inline=false){
TypePalConfig config=rascalTypePalConfig(ms.pathConfig), bool inline=false){

pcfg = ms.pathConfig;
modelName = intercalate(" + ", toList(moduleNames));
Expand Down Expand Up @@ -405,7 +405,7 @@ list[Message] dummy_compile1(str _qualifiedModuleName, lang::rascal::\syntax::Ra
list[ModuleMessages] check(list[loc] moduleLocs, PathConfig pcfg, CompilerConfig compilerConfig){
pcfg1 = pcfg; pcfg1.classloaders = []; pcfg1.javaCompilerPath = [];
//println("=== check: <moduleLocs>"); iprintln(pcfg1);
ms = rascalTModelForLocs(moduleLocs, rascalTypePalConfig(rascalPathConfig = pcfg), compilerConfig, dummy_compile1);
ms = rascalTModelForLocs(moduleLocs, rascalTypePalConfig(pcfg), compilerConfig, dummy_compile1);
return [ program(ms.moduleLocs[mname], toSet(ms.messages[mname])) | mname <- ms.messages ];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ start syntax Modules

TModel rascalTModelForTestModules(Tree pt, bool debug=false){
ms = getInlineImportAndExtendGraph(pt, getDefaultPathConfig());
TypePalConfig config=rascalTypePalConfig();
TypePalConfig config=rascalTypePalConfig(getDefaultPathConfig());
if(debug){
config = config[logImports = true];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -422,9 +422,8 @@ loc rascalCreateLogicalLoc(Define def, str _modelName, PathConfig pcfg){
return def.defined;
}

TypePalConfig rascalTypePalConfig(
bool logImports = false,
PathConfig rascalPathConfig = pathConfig()
TypePalConfig rascalTypePalConfig(PathConfig rascalPathConfig,
bool logImports = false
)
= tconfig(
logImports = logImports,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import lang::rascal::\syntax::Rascal;

import lang::rascalcore::check::Checker;

PathConfig testingConfig() {
PathConfig pathConfigForTesting() {
return getDefaultPathConfig();
}

Expand Down Expand Up @@ -64,7 +64,7 @@ set[Message] getAllMessages(ModuleStatus r)

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()[verbose=verbose], dummy_compile1);
return rascalTModelForLocs([mloc], rascalTypePalConfig(pathConfigForTesting()), getRascalCompilerConfig(), dummy_compile1);
}

bool check(str stmts, list[str] expected, list[str] importedModules = [], list[str] initialDecls = []){
Expand All @@ -89,8 +89,12 @@ bool checkOK(str stmts, list[str] importedModules = [], list[str] initialDecls =
}

bool checkModuleOK(loc moduleToCheck){
<<<<<<< HEAD
//rascalTModelForLocs([moduleToCheck], testingConfig(), rascalTypePalConfig());
errors = getErrorMessages(rascalTModelForLocs([moduleToCheck], rascalTypePalConfig(rascalPathConfig=testingConfig()), getRascalCompilerConfig(), dummy_compile1));
=======
errors = getErrorMessages(rascalTModelForLocs([moduleToCheck], rascalTypePalConfig(pathConfigForTesting()), getRascalCompilerConfig(), dummy_compile1));
>>>>>>> e1f02a88 (Changed keyword parameter rascalPathConfig to positional parameter)
if(size(errors) == 0)
return true;
throw abbrev("<errors>");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ list[Message] compile(loc moduleLoc, PathConfig pcfg, CompilerConfig compilerCon
list[Message] compile(str qualifiedModuleName, PathConfig pcfg, CompilerConfig compilerConfig){
jobStart("RascalCompiler");// TODO: monitor
start_comp = cpuTime();
ms = rascalTModelForNames([qualifiedModuleName], rascalTypePalConfig(rascalPathConfig = pcfg), compilerConfig, compile1);
ms = rascalTModelForNames([qualifiedModuleName], rascalTypePalConfig(pcfg), compilerConfig, compile1);

comp_time = (cpuTime() - start_comp)/1000000;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,12 @@ void main() {
|project://typepal/src|],
libs = [|lib:///| ]
);
ModuleStatus result = rascalTModelForNames([input_module], testConfig,
rascalTypePalConfig(
classicReifier=true
//logSolverSteps=true,
//logSolverIterations=true,
//logAttempts=true
),
ModuleStatus result = rascalTModelForNames([input_module],
rascalTypePalConfig(testConfig),
getRascalCompilerConfig(),
dummy_compile1
);
iprintln(result.tmodels[input_module], lineLimit=10000);
iprintln(result.tmodels[input_module].messages);
println("Total time for checker: <(cpuTime() - start_time)/1000000> ms");
}
/*
rascalTModelForNames(["lang::rascalcore::compile::Examples::Tst0"], getRascalCorePathConfig(),
rascalTypePalConfig(
classicReifier=true,
//logSolverSteps=true,
//logSolverIterations=true,
logAttempts=true
));
*/
}

0 comments on commit 104fe83

Please sign in to comment.