Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions src/org/rascalmpl/compiler/lang/rascalcore/check/RascalConfig.rsc
Original file line number Diff line number Diff line change
Expand Up @@ -374,10 +374,17 @@ bool rascalReportUnused(loc def, TModel tm){
return true;
}

bool isSourceFile(loc l, PathConfig pcfg){
for(src <- pcfg.srcs){
if(relativize(src, l) != l) return true;
}
return false;
}

// Extend the path relation by
// - adding transitive edges for extend
// - adding imports via these extends
rel[loc, PathRole,loc] enhancePathRelation(rel[loc, PathRole,loc] paths){
rel[loc, PathRole,loc] enhancePathRelation(rel[loc, PathRole,loc] paths, PathConfig pcfg){
extendPlus = {<from, to> | <loc from, extendPath(), loc to> <- paths}+;
paths += { <from, extendPath(), to> | <loc from, loc to> <- extendPlus};

Expand All @@ -388,13 +395,22 @@ rel[loc, PathRole,loc] enhancePathRelation(rel[loc, PathRole,loc] paths){
from != to2
};
paths += delta;

// paths = {<isSourceFile(from, pcfg) ? from : getRascalModuleLocation(getRascalModuleName(from, pcfg), pcfg),
// pathRole,
// isSourceFile(to, pcfg) ? to : getRascalModuleLocation(getRascalModuleName(to, pcfg), pcfg)
// >
// | <from, pathRole, to> <- paths
// };
// iprintln(paths);
return paths;
}

// Enhance TModel before running Solver by

TModel rascalPreSolver(map[str,Tree] _namedTrees, TModel m){
return m[paths = enhancePathRelation(m.paths)];
res = m[paths = enhancePathRelation(m.paths, m.config.typepalPathConfig)];
return res;
}

void checkOverloading(map[str,Tree] namedTrees, Solver s){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,58 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
}
module lang::rascalcore::compile::Examples::Tst1
import lang::rascalcore::check::Checker;
import util::FileSystem;
import util::PathConfig;
import IO;
data PathRole = extendPath();
import Message;

void main() {
x = <|file:///Users/paulklint/git/rascal/src/org/rascalmpl/compiler/lang/rascalcore/compile/Examples/B.rsc|(0,1837,<1,0>,<50,7>),extendPath(),|file:///Users/paulklint/git/rascal/src/org/rascalmpl/compiler/lang/rascalcore/compile/Examples/B.rsc|(0,1837,<1,0>,<50,7>)>;
iprintln({x, x});
}
private void runChecker(PathConfig pcfg, bool (loc m) validModule) {
result = check([m | src <- pcfg.srcs, m <- find(src, "rsc"), validModule(m)], rascalCompilerConfig(pcfg));
for (/e:error(_,_) := result) {
println(e);
}
}

private void runChecker(PathConfig pcfg, list[str] modules) {
result = check([getRascalModuleLocation(m, pcfg) | m <- modules], rascalCompilerConfig(pcfg));
for (/e:error(_,_) := result) {
println(e);
}
}

// void main(loc repoRoot = |file:///Users/paulklint/git/|, loc tplRoot = |file:///Users/paulklint/rascal-tpls|) {
// rascalPcfg = pathConfig(srcs=[repoRoot + "rascal/src/org/rascalmpl/library"], bin=tplRoot + "rascal");
// salixCorePcfg = pathConfig(srcs=[repoRoot + "salix-core/src/main/rascal"], bin=tplRoot + "salix-core", libs=[rascalPcfg.bin]);
// salixContribPcfg = pathConfig(srcs=[repoRoot + "salix-contrib/src/main/rascal"], bin=tplRoot + "salix-core", libs=[rascalPcfg.bin, salixCorePcfg.bin]);

// // println("**** Checking rascal");
// // runChecker(rascalPcfg, bool (loc m) { return /lang.rascal/ !:= m.path && /experiments/ !:= m.path && /lang.rascal.*tests/ !:= m.path; });


// // println("**** Checking salix-core");
// // runChecker(salixCorePcfg, bool (loc m) { return true; });

// println("**** Checking salix-contrib");
// //runChecker(salixContribPcfg, ["salix::util::Mode"]);
// runChecker(salixContribPcfg, bool (loc m) { return true; });
// }

void main(loc repoRoot = |file:///Users/paulklint/git/|, loc tplRoot = |file:///Users/paulklint/rascal-tpls|) {
rascalPcfg = pathConfig(srcs=[repoRoot + "rascal/src/org/rascalmpl/library"], bin=tplRoot + "rascal");
salixCorePcfg = pathConfig(srcs=[repoRoot + "salix-core/src/main/rascal"], bin=tplRoot + "salix-core", libs=[rascalPcfg.bin]);
salixContribPcfg = pathConfig(srcs=[repoRoot + "salix-contrib/src/main/rascal"], bin=tplRoot + "salix-core", libs=[rascalPcfg.bin, salixCorePcfg.bin]);

remove(|file:///Users/paulklint/rascal-tpls|);
println("**** Checking rascal");
runChecker(rascalPcfg, ["ParseTree", "String"]);
// runChecker(rascalPcfg, bool (loc m) { return /lang.rascal/ !:= m.path && /experiments/ !:= m.path && /lang.rascal.*tests/ !:= m.path; });


// println("**** Checking salix-core");
// runChecker(salixCorePcfg, bool (loc m) { return true; });

println("**** Checking salix-contrib");
runChecker(salixContribPcfg, ["salix::util::Mode"]);
//runChecker(salixContribPcfg, bool (loc m) { return true; });
}