use of ast.ExpCore in project L42 by ElvisResearchGroup.
the class PropagatorVisitor method visit.
public Void visit(MCall s) {
lift(s.getInner());
liftMs(s.getS());
liftDoc(s.getDoc());
for (ExpCore e : s.getEs()) {
lift(e);
}
return null;
}
use of ast.ExpCore in project L42 by ElvisResearchGroup.
the class ExtractCtxCompiled method visit.
public Ctx<ClassB> visit(MCall s) {
if (!IsCompiled.of(s.getInner())) {
return lift(s.getInner().accept(this), s::withInner);
}
for (ExpCore ei : s.getEs()) {
if (IsCompiled.of(ei)) {
continue;
}
return lift(ei.accept(this), ctx -> {
List<ExpCore> es = new ArrayList<ExpCore>(s.getEs());
es.set(es.indexOf(ei), ctx);
return s.withEs(es);
});
}
throw Assertions.codeNotReachable();
}
use of ast.ExpCore in project L42 by ElvisResearchGroup.
the class ExtractCtxUpToX method visit.
public Ctx<Block> visit(Using s) {
for (ExpCore ei : s.getEs()) {
if (!IsCtx.of(ei)) {
continue;
}
return lift(ei.accept(this), ctx -> {
List<ExpCore> es = new ArrayList<ExpCore>(s.getEs());
es.set(es.indexOf(ei), ctx);
return s.withEs(es);
});
}
throw Assertions.codeNotReachable();
}
use of ast.ExpCore in project L42 by ElvisResearchGroup.
the class ExtractCtxVal method visit.
public Ctx<Redex> visit(MCall s) {
Ctx<Redex> res = checkRedex(s);
if (res != null) {
return res;
}
if (!IsValue.of(p, s.getInner())) {
return lift(s.getInner().accept(this), ctx -> s.withInner(ctx));
}
for (ExpCore ei : s.getEs()) {
if (IsValue.of(p, ei)) {
continue;
}
return lift(ei.accept(this), ctx -> {
List<ExpCore> es = new ArrayList<ExpCore>(s.getEs());
es.set(es.indexOf(ei), ctx);
return s.withEs(es);
});
}
return null;
}
use of ast.ExpCore in project L42 by ElvisResearchGroup.
the class ExtractThrow method visit.
public ExpCore visit(Block s) {
if (!s.getOns().isEmpty()) {
return new ExpCore.WalkBy();
}
for (int i = 0; i < s.getDecs().size(); i++) {
if (new IsValue(p).validDv(s.getDecs().get(i))) {
continue;
}
//otherwise, i is the first non dv
ExpCore res = s.getDecs().get(i).getInner().accept(this);
if (res instanceof ExpCore.WalkBy) {
return res;
}
Signal res_ = (Signal) res;
List<Block.Dec> decs = s.getDecs().subList(0, i);
Block newInner = new Block(s.getDoc(), decs, res_.getInner(), Collections.emptyList(), s.getP());
newInner = Functions.garbage(newInner, i);
return res_.withInner(newInner);
}
ExpCore res = s.getInner().accept(this);
if (res instanceof ExpCore.WalkBy) {
return res;
}
Signal res_ = (Signal) res;
Block newInner = s.withInner(res_.getInner());
return res_.withInner(newInner);
}
Aggregations