| Index: editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/util/ToFormattedSourceVisitor.java
|
| diff --git a/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/util/ToFormattedSourceVisitor.java b/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/util/ToFormattedSourceVisitor.java
|
| index d3e6990bc18c35a216029603bb00e6275a890ed4..1bd4d3d128ce7cbfd3d230686a09504055c8ade6 100644
|
| --- a/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/util/ToFormattedSourceVisitor.java
|
| +++ b/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/util/ToFormattedSourceVisitor.java
|
| @@ -28,6 +28,8 @@ import java.util.List;
|
| */
|
| public class ToFormattedSourceVisitor implements AstVisitor<Void> {
|
| public static final String COMMENTS_KEY = "List of comments before statement";
|
| + public static final String BLOCK_BODY_KEY = "Block body source";
|
| + public static final String EXPRESSION_BODY_KEY = "Expression body source";
|
|
|
| /**
|
| * The writer to which the source is to be written.
|
| @@ -691,10 +693,25 @@ public class ToFormattedSourceVisitor implements AstVisitor<Void> {
|
| if (!node.isGetter()) {
|
| visitNode(node.getParameters());
|
| }
|
| - if (!(node.getBody() instanceof EmptyFunctionBody)) {
|
| - writer.print(' ');
|
| + String bodySource;
|
| + if ((bodySource = (String) node.getProperty(BLOCK_BODY_KEY)) != null) {
|
| + writer.print(" {");
|
| + if (!bodySource.isEmpty()) {
|
| + nl();
|
| + writer.print(bodySource);
|
| + }
|
| + nl2();
|
| + writer.print('}');
|
| + } else if ((bodySource = (String) node.getProperty(EXPRESSION_BODY_KEY)) != null) {
|
| + writer.print(" => ");
|
| + writer.print(bodySource);
|
| + writer.print(';');
|
| + } else {
|
| + if (!(node.getBody() instanceof EmptyFunctionBody)) {
|
| + writer.print(' ');
|
| + }
|
| + visitNode(node.getBody());
|
| }
|
| - visitNode(node.getBody());
|
| return null;
|
| }
|
|
|
|
|