Search in sources :

Example 26 with Expression

use of ast.Expression in project L42 by ElvisResearchGroup.

the class CloneVisitor method visit.

@Override
public Expression visit(RoundBlock s) {
    List<BlockContent> content = Map.of(this::liftBC, s.getContents());
    Expression inner = lift(s.getInner());
    Expression result = new RoundBlock(s.getP(), liftDoc(s.getDoc()), inner, content);
    //assert L42.checkWellFormedness(result);
    return result;
}
Also used : Expression(ast.Expression)

Example 27 with Expression

use of ast.Expression in project L42 by ElvisResearchGroup.

the class DesugarContext method of.

public static Expression of(Set<String> usedVars, Expression e) {
    DesugarContext d = new DesugarContext();
    d.usedVars = usedVars;
    Expression result = e.accept(d);
    return result;
//TODO: need to check there is no \ out of scope, that would be ill formed
//it is a subset of what is asserted now with checkRemoved.
}
Also used : Expression(ast.Expression)

Example 28 with Expression

use of ast.Expression in project L42 by ElvisResearchGroup.

the class DesugarNormalizeReceiver method of.

public static Expression of(Set<String> usedVars, Expression e) {
    DesugarNormalizeReceiver d = new DesugarNormalizeReceiver();
    d.usedVars = usedVars;
    Expression result = e.accept(d);
    return result;
}
Also used : Expression(ast.Expression)

Example 29 with Expression

use of ast.Expression in project L42 by ElvisResearchGroup.

the class Desugar method visit.

public Expression visit(RoundBlock s) {
    s = blockEtoXE(s);
    //s=blockInferVar(s);
    HashMap<String, Type> oldVarEnv = new HashMap<String, Type>(varEnv);
    try {
        if (!s.getContents().isEmpty()) {
            addAllDec(s.getContents().get(0).getDecs());
        }
        Expression result = super.visit(s);
        return result;
    } finally {
        varEnv = oldVarEnv;
    }
}
Also used : Type(ast.Ast.Type) MethodWithType(ast.Expression.ClassB.MethodWithType) MethodType(ast.Ast.MethodType) HashMap(java.util.HashMap) Expression(ast.Expression)

Example 30 with Expression

use of ast.Expression in project L42 by ElvisResearchGroup.

the class Desugar method getBlock.

static RoundBlock getBlock(Position p, String x, Expression xe, Expression inner) {
    List<Expression.BlockContent> bc = new ArrayList<>();
    List<VarDec> decs = new ArrayList<VarDec>();
    decs.add(new VarDecXE(false, Optional.empty(), x, xe));
    bc.add(new Expression.BlockContent(decs, Collections.emptyList()));
    return new RoundBlock(p, Doc.empty(), inner, bc);
}
Also used : Expression(ast.Expression) VarDec(ast.Ast.VarDec) ArrayList(java.util.ArrayList) RoundBlock(ast.Expression.RoundBlock) VarDecXE(ast.Ast.VarDecXE)

Aggregations

Expression (ast.Expression)66 ArrayList (java.util.ArrayList)24 VarDec (ast.Ast.VarDec)14 X (ast.Expression.X)13 Type (ast.Ast.Type)11 VarDecXE (ast.Ast.VarDecXE)11 ExpCore (ast.ExpCore)11 Catch (ast.Expression.Catch)11 RoundBlock (ast.Expression.RoundBlock)11 VarDecE (ast.Ast.VarDecE)10 Doc (ast.Ast.Doc)8 Position (ast.Ast.Position)8 MethodSelectorX (ast.Ast.MethodSelectorX)7 Parameters (ast.Ast.Parameters)7 MethodWithType (ast.Expression.ClassB.MethodWithType)7 MethodType (ast.Ast.MethodType)6 ClassB (ast.ExpCore.ClassB)6 InjectionOnCore (sugarVisitors.InjectionOnCore)6 Ast (ast.Ast)5 Path (ast.Ast.Path)4