| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 import 'dart:io'; | 5 import 'dart:io'; |
| 6 | 6 |
| 7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
| 8 import 'package:analyzer/dart/ast/token.dart'; | 8 import 'package:analyzer/dart/ast/token.dart'; |
| 9 import 'package:analyzer/dart/element/element.dart'; | 9 import 'package:analyzer/dart/element/element.dart'; |
| 10 import 'package:analyzer/dart/element/type.dart'; | 10 import 'package:analyzer/dart/element/type.dart'; |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 | 271 |
| 272 void writeExpression(AstNode e, [Expression enclosing]) { | 272 void writeExpression(AstNode e, [Expression enclosing]) { |
| 273 bool needsParenthesis = e is Expression && | 273 bool needsParenthesis = e is Expression && |
| 274 enclosing != null && | 274 enclosing != null && |
| 275 e.precedence < enclosing.precedence; | 275 e.precedence < enclosing.precedence; |
| 276 | 276 |
| 277 if (needsParenthesis) { | 277 if (needsParenthesis) { |
| 278 buffer.write('('); | 278 buffer.write('('); |
| 279 } | 279 } |
| 280 | 280 |
| 281 if (e is Annotation) { | 281 if (e == null) { |
| 282 buffer.write('<null>'); |
| 283 } else if (e is Annotation) { |
| 282 buffer.write('@'); | 284 buffer.write('@'); |
| 283 writeExpression(e.name); | 285 writeExpression(e.name); |
| 284 if (e.constructorName != null) { | 286 if (e.constructorName != null) { |
| 285 buffer.write('.'); | 287 buffer.write('.'); |
| 286 writeExpression(e.constructorName); | 288 writeExpression(e.constructorName); |
| 287 } | 289 } |
| 288 if (e.arguments != null) { | 290 if (e.arguments != null) { |
| 289 writeList('(', ')', e.arguments.arguments, ', ', writeExpression, | 291 writeList('(', ')', e.arguments.arguments, ', ', writeExpression, |
| 290 includeEmpty: true); | 292 includeEmpty: true); |
| 291 } | 293 } |
| (...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 889 return components.join(';'); | 891 return components.join(';'); |
| 890 } | 892 } |
| 891 } | 893 } |
| 892 | 894 |
| 893 class _Replacement { | 895 class _Replacement { |
| 894 final int offset; | 896 final int offset; |
| 895 final int end; | 897 final int end; |
| 896 final String text; | 898 final String text; |
| 897 _Replacement(this.offset, this.end, this.text); | 899 _Replacement(this.offset, this.end, this.text); |
| 898 } | 900 } |
| OLD | NEW |