use of dyvilx.tools.compiler.ast.expression.access.MethodCall in project Dyvil by Dyvil.
the class FuncDirective method convertBlock.
protected static StatementList convertBlock(StatementList block) {
final StatementList value = new StatementList();
// new StringWriter()
final ConstructorCall newStringWriter = new ConstructorCall(null, Template.LazyTypes.StringWriter, ArgumentList.EMPTY);
// let writer = new StringWriter()
final Variable writer = new Variable(Name.fromRaw("writer"), Template.LazyTypes.Writer, newStringWriter);
writer.getAttributes().addFlag(Modifiers.FINAL | Modifiers.GENERATED);
// { let writer = new StringWriter; { ... }; writer.toString }
value.add(new VariableStatement(writer));
value.add(block);
value.add(new MethodCall(null, new FieldAccess(writer), Names.toString));
return value;
}
Aggregations