use of ast.Util.PathPath in project L42 by ElvisResearchGroup.
the class Redirect method traspose.
private static Path traspose(List<PathPath> verified, Path pi) {
if (pi.isPrimitive()) {
return pi;
}
if (pi.outerNumber() > 0) {
return pi;
}
PathPath selectPP = selectPP(verified, pi);
assert selectPP != null : verified + " " + pi;
pi = selectPP.getPath2();
return pi;
}
use of ast.Util.PathPath in project L42 by ElvisResearchGroup.
the class Errors42 method errorIncoherentRedirectMapping.
/* static void checkCoherentMapping(List<PathPath> setVisited) {
// setVisited is a set of individual redirected classes,
// created by walking the sub-tree under each cascade redirect.
// getPath1() is the path in the library before redirecting.
// getPath2() is the proposed path in the redirected library.
// We will allow many paths to be redirected into a single new path,
// but not vice-versa.
for(PathPath p1:setVisited){
for(PathPath p2:setVisited){
if(p1.equals(p2)){continue;}
if(p1.getPath1().equals(p2.getPath1())){
throw errorIncoherentRedirectMapping(setVisited, p1.getPath1(),p1.getPath2(),p2.getPath2());
}
}
}
return;
}*/
static Error errorIncoherentRedirectMapping(List<PathPath> verified, List<PathSPath> ambiguities, Path incoSrc, List<Path> _incoDest) {
Doc src = Doc.empty();
Doc dest = Doc.empty();
//Doc ambig=Doc.empty();
for (PathPath v : verified) {
src = src.sum(formatPathIn(v.getPath1().getCBar()));
dest = dest.sum(formatPathOut(v.getPath2()));
}
for (PathSPath a : ambiguities) {
//if(a.getPaths().size()!=1){
// ambig=ambig.sum(formatPathIn(a.getPath().getCBar()));
// ambig=ambig.sum(Doc.factory("@"+a.getPaths().size()));
// }
Doc srci = formatPathIn(a.getPath().getCBar());
for (Path pij : a.getPathsSet()) {
src = src.sum(srci);
dest = dest.sum(formatPathOut(pij));
}
}
Doc incoDest = Doc.empty();
for (Path pi : _incoDest) {
incoDest = incoDest.sum(formatPathOut(pi));
}
return Resources.Error.multiPartStringError("IncoherentRedirectMapping", "Src", src.formatNewLinesAsList(), "Dest", dest.formatNewLinesAsList(), //"Ambiguities",ambig.formatNewLinesAsList(),
"IncoherentSrc", incoSrc == null ? Doc.empty() : formatPathIn(incoSrc.getCBar()), "IncoherentDest", incoDest.formatNewLinesAsList());
}
Aggregations