Search in sources :

Example 11 with ExpCore

use of ast.ExpCore in project L42 by ElvisResearchGroup.

the class CtxL method equals.

public boolean equals(Object obj) {
    if (this == obj)
        return true;
    if (obj == null)
        return false;
    if (getClass() != obj.getClass())
        return false;
    CtxL other = (CtxL) obj;
    ExpCore oE = other.fillHole(new ExpCore.WalkBy());
    ExpCore thisE = this.fillHole(new ExpCore.WalkBy());
    return thisE.equals(oE);
}
Also used : ExpCore(ast.ExpCore)

Example 12 with ExpCore

use of ast.ExpCore in project L42 by ElvisResearchGroup.

the class CtxL method _split.

public static CtxL _split(ExpCore.ClassB l) {
    int pos = firstNotCompiled(l.getMs());
    if (pos == l.getMs().size()) {
        return null;
    }
    Member m = l.getMs().get(pos);
    ExpCore inner = m.getInner();
    boolean metaReady = m instanceof NestedClass && IsCompiled.of(m.getInner());
    CtxC innerSplit;
    if (metaReady) {
        innerSplit = CtxC.hole(inner);
    } else {
        innerSplit = CtxC.split(inner);
    }
    return new CtxL(l, pos, innerSplit);
}
Also used : ExpCore(ast.ExpCore) NestedClass(ast.ExpCore.ClassB.NestedClass) Member(ast.ExpCore.ClassB.Member)

Example 13 with ExpCore

use of ast.ExpCore in project L42 by ElvisResearchGroup.

the class Norm method normMwt.

protected MethodWithType normMwt(Program p, MethodWithType mwt) {
    MethodType mt = mwt.getMt();
    Optional<ExpCore> e = mwt.get_inner().map(e1 -> e1.accept(new CloneVisitor() {

        @Override
        public ExpCore visit(ClassB cb) {
            return norm(p.evilPush(cb));
        }
    }));
    return mwt.withMt(mt).with_inner(e);
}
Also used : MethodType(ast.Ast.MethodType) ExpCore(ast.ExpCore) CloneVisitor(coreVisitors.CloneVisitor) ClassB(ast.ExpCore.ClassB)

Example 14 with ExpCore

use of ast.ExpCore in project L42 by ElvisResearchGroup.

the class Executor method subst.

public static ExpCore subst(ExpCore ctxVal, Redex.Subst r) {
    Block e1 = r.getThat();
    int i = r.getSubstIndex();
    ExpCore val = e1.getDecs().get(i).getInner();
    String x = e1.getDecs().get(i).getX();
    ArrayList<Block.Dec> decs = new ArrayList<Block.Dec>(e1.getDecs());
    decs.remove(i);
    Block e2 = new Block(e1.getDoc(), decs, e1.getInner(), e1.getOns(), e1.getP());
    ExpCore result = ReplaceX.of(e2, val, x);
    return ReplaceCtx.of(ctxVal, result);
}
Also used : ExpCore(ast.ExpCore) Dec(ast.ExpCore.Block.Dec) ArrayList(java.util.ArrayList) Block(ast.ExpCore.Block)

Example 15 with ExpCore

use of ast.ExpCore in project L42 by ElvisResearchGroup.

the class Executor method meta1Prop.

protected ClassB meta1Prop(Program p, ClassB cb, NestedClass m) {
    log("---meta1Prop--");
    //get cb-->ct
    //get p'
    Program p1 = p.evilPush(cb);
    //extract e
    ExpCore e = m.getInner();
    //extract cb
    Ctx<ClassB> ctxC = ExtractCtxCompiled.of(e);
    //run cb1-->cb2
    ClassB cb2 = (ClassB) step(new PData(p1), ctxC.hole);
    ExpCore e2 = ReplaceCtx.of(ctxC.ctx, cb2);
    //compose cb with new member
    return cb.withMember(m.withInner(e2));
}
Also used : ExpCore(ast.ExpCore) Program(programReduction.Program) PData(facade.PData) ClassB(ast.ExpCore.ClassB)

Aggregations

ExpCore (ast.ExpCore)62 ArrayList (java.util.ArrayList)25 ClassB (ast.ExpCore.ClassB)18 Member (ast.ExpCore.ClassB.Member)11 MethodWithType (ast.ExpCore.ClassB.MethodWithType)10 Expression (ast.Expression)10 Block (ast.ExpCore.Block)9 MethodType (ast.Ast.MethodType)8 Doc (ast.Ast.Doc)7 Path (ast.Ast.Path)7 Assertions (tools.Assertions)7 MethodSelector (ast.Ast.MethodSelector)6 Position (ast.Ast.Position)6 Program (programReduction.Program)6 InjectionOnCore (sugarVisitors.InjectionOnCore)6 Ast (ast.Ast)5 Type (ast.Ast.Type)5 ErrorMessage (ast.ErrorMessage)5 CloneVisitor (coreVisitors.CloneVisitor)5 List (java.util.List)5