Search in sources :

Example 1 with On

use of ast.Expression.With.On in project L42 by ElvisResearchGroup.

the class ToAst method parseOnPlus.

private On parseOnPlus(OnPlusContext on) {
    List<Type> ts = new ArrayList<Type>();
    for (TContext t : on.t()) {
        ts.add(parseType(t));
    }
    Expression inner = on.eTop((on.Case() == null) ? 0 : 1).accept(this);
    return new On(ts, inner);
}
Also used : Type(ast.Ast.Type) Expression(ast.Expression) On(ast.Expression.With.On)

Example 2 with On

use of ast.Expression.With.On 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));
}
Also used : Expression(ast.Expression) ArrayList(java.util.ArrayList) On(ast.Expression.With.On) VarDecE(ast.Ast.VarDecE) On(ast.Expression.With.On) With(ast.Expression.With)

Aggregations

Expression (ast.Expression)2 On (ast.Expression.With.On)2 Type (ast.Ast.Type)1 VarDecE (ast.Ast.VarDecE)1 With (ast.Expression.With)1 ArrayList (java.util.ArrayList)1