use of ast.Ast.VarDec in project L42 by ElvisResearchGroup.
the class FlatFirstLevelLocalNestedClasses method liftVarDecs.
protected List<ast.Ast.VarDec> liftVarDecs(List<ast.Ast.VarDec> ds) {
List<ast.Ast.VarDec> result = new ArrayList<>();
for (VarDec d : ds) {
if (!(d instanceof ast.Ast.VarDecCE)) {
result.add(d);
continue;
}
NestedClass nc = ((ast.Ast.VarDecCE) d).getInner();
collected.add(nc);
}
return super.liftVarDecs(result);
}
use of ast.Ast.VarDec in project L42 by ElvisResearchGroup.
the class DesugarCatchDefault method liftBC.
protected BlockContent liftBC(BlockContent c) {
if (c.get_catch().isEmpty()) {
return super.liftBC(c);
}
List<Catch> ks = Map.of(this::liftK, c.get_catch());
Type oldR = this.lastReturn;
this.lastReturn = newR(ks);
try {
List<VarDec> liftVarDecs = liftVarDecs(c.getDecs());
return new BlockContent(liftVarDecs, ks);
} finally {
this.lastReturn = oldR;
}
}
use of ast.Ast.VarDec in project L42 by ElvisResearchGroup.
the class DesugarVars method getFakeBlock.
private RoundBlock getFakeBlock(X x, X z, RoundBlock s, List<VarDec> varDecs, int d3First) {
Position pos = Desugar.getPosition(s);
List<Expression.BlockContent> fakeContent = new ArrayList<>();
List<VarDec> fakeDecs = new ArrayList<VarDec>();
if (d3First != -1) {
//d3 not empty
fakeDecs.addAll(varDecs.subList(d3First, varDecs.size()));
}
fakeContent.add(new Expression.BlockContent(fakeDecs, s.getContents().get(0).get_catch()));
RoundBlock fake = s.withContents(fakeContent);
fake = (RoundBlock) XEqOpInZEqOp.of(x, z, fake);
fake = (RoundBlock) XInE.of(x, Desugar.getMCall(pos, z, "#inner", Desugar.getPs()), fake);
return fake;
}
use of ast.Ast.VarDec 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);
}
use of ast.Ast.VarDec in project L42 by ElvisResearchGroup.
the class Desugar method getBlockContent.
public static Expression.BlockContent getBlockContent(Expression e, Expression.Catch k) {
List<VarDec> single = new ArrayList<VarDec>();
single.add(new VarDecE(e));
return new Expression.BlockContent(single, Collections.singletonList(k));
}
Aggregations