Chromium Code Reviews| Index: pkg/analyzer/lib/src/generated/parser.dart |
| diff --git a/pkg/analyzer/lib/src/generated/parser.dart b/pkg/analyzer/lib/src/generated/parser.dart |
| index 42a52424a0300a19c74afee7cac618dcc11a5215..dd4627993bbbdd04680f05d57c92e435495d6f1e 100644 |
| --- a/pkg/analyzer/lib/src/generated/parser.dart |
| +++ b/pkg/analyzer/lib/src/generated/parser.dart |
| @@ -8563,6 +8563,10 @@ class ResolutionCopier implements AstVisitor<bool> { |
| class ToFormattedSourceVisitor implements AstVisitor<Object> { |
|
Brian Wilkerson
2014/03/07 16:12:31
I don't understand why this class is here. It is p
scheglov
2014/03/07 22:47:44
You are right.
I used it once about a year ago, bu
|
| static String COMMENTS_KEY = "List of comments before statement"; |
| + static String BLOCK_BODY_KEY = "Block body source"; |
| + |
| + static String EXPRESSION_BODY_KEY = "Expression body source"; |
| + |
| /** |
| * The writer to which the source is to be written. |
| */ |
| @@ -9161,10 +9165,25 @@ class ToFormattedSourceVisitor implements AstVisitor<Object> { |
| if (!node.isGetter) { |
| visitNode(node.parameters); |
| } |
| - if (node.body is! EmptyFunctionBody) { |
| - _writer.print(' '); |
| + String bodySource; |
| + if ((bodySource = node.getProperty(BLOCK_BODY_KEY) as String) != null) { |
| + _writer.print(" {"); |
| + if (!bodySource.isEmpty) { |
| + nl(); |
| + _writer.print(bodySource); |
| + } |
| + nl2(); |
| + _writer.print('}'); |
| + } else if ((bodySource = node.getProperty(EXPRESSION_BODY_KEY) as String) != null) { |
| + _writer.print(" => "); |
| + _writer.print(bodySource); |
| + _writer.print(';'); |
| + } else { |
| + if (node.body is! EmptyFunctionBody) { |
| + _writer.print(' '); |
| + } |
| + visitNode(node.body); |
| } |
| - visitNode(node.body); |
| return null; |
| } |