use of ast.Expression.CurlyBlock in project L42 by ElvisResearchGroup.
the class DesugarVars method visit.
public Expression visit(CurlyBlock s) {
Expression inner;
if (s.getContents().size() == 1 && s.getContents().get(0).get_catch().isEmpty() && s.getContents().get(0).getDecs().size() == 1 && s.getContents().get(0).getDecs().get(0) instanceof VarDecE) {
inner = ((VarDecE) s.getContents().get(0).getDecs().get(0)).getInner();
} else {
inner = new RoundBlock(s.getP(), s.getDoc(), Expression._void.instance, s.getContents());
}
inner = inner.accept(this);
List<VarDec> vd = Collections.singletonList((VarDec) new VarDecE(inner));
BlockContent o = new BlockContent(vd, Collections.emptyList());
return new CurlyBlock(s.getP(), Doc.empty(), Collections.singletonList(o));
}
Aggregations