use of ast.Expression.With in project L42 by ElvisResearchGroup.
the class DesugarW method oldWith_noUseKw.
private void oldWith_noUseKw(SquareWithCall s, X xX, List<VarDec> decs) {
List<With.On> ons = s.getWith().getOns();
List<With.On> onsPrime = new ArrayList<>();
for (With.On on : ons) {
onsPrime.add(on.withInner(withSquareAdd(s.getP(), xX, on.getInner())));
}
Optional<Expression> def = s.getWith().getDefaultE();
Optional<Expression> defPrime = Map.of(e -> withSquareAdd(s.getP(), xX, e), def);
With w = s.getWith().withOns(onsPrime).withDefaultE(defPrime);
decs.add(new VarDecE(w));
}
use of ast.Expression.With in project L42 by ElvisResearchGroup.
the class DesugarW method innerWithXs.
private static Expression innerWithXs(With e) {
//right side of case b and part of right side of case d
Expression inner = e.getDefaultE().get();
List<String> xs = new ArrayList<String>(e.getXs());
for (VarDecXE d : e.getDecs()) {
xs.add(d.getX());
}
for (VarDecXE d : e.getIs()) {
xs.add(d.getX());
}
inner = new With(e.getP(), xs, Collections.emptyList(), Collections.emptyList(), e.getOns(), e.getDefaultE());
return inner;
}