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);
}
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);
}
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);
}
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);
}
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));
}
Aggregations