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:async'; |
| 6 |
5 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
6 import 'package:analyzer/dart/element/element.dart'; | 8 import 'package:analyzer/dart/element/element.dart'; |
7 import 'package:analyzer/dart/element/type.dart'; | 9 import 'package:analyzer/dart/element/type.dart'; |
8 import 'package:analyzer/src/dart/analysis/driver.dart'; | 10 import 'package:analyzer/src/dart/analysis/driver.dart'; |
9 import 'package:analyzer/src/generated/resolver.dart'; | 11 import 'package:analyzer/src/generated/resolver.dart'; |
10 import 'package:analyzer/src/generated/source.dart'; | 12 import 'package:analyzer/src/generated/source.dart'; |
11 import 'package:analyzer_plugin/src/utilities/change_builder/change_builder_dart
.dart'; | 13 import 'package:analyzer_plugin/src/utilities/change_builder/change_builder_dart
.dart'; |
12 import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar
t'; | 14 import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dar
t'; |
13 | 15 |
14 /** | 16 /** |
15 * A [ChangeBuilder] used to build changes in Dart files. | 17 * A [ChangeBuilder] used to build changes in Dart files. |
16 * | 18 * |
17 * Clients may not extend, implement or mix-in this class. | 19 * Clients may not extend, implement or mix-in this class. |
18 */ | 20 */ |
19 abstract class DartChangeBuilder extends ChangeBuilder { | 21 abstract class DartChangeBuilder extends ChangeBuilder { |
20 /** | 22 /** |
21 * Initialize a newly created change builder. | 23 * Initialize a newly created change builder. |
22 */ | 24 */ |
23 factory DartChangeBuilder(AnalysisDriver driver) = DartChangeBuilderImpl; | 25 factory DartChangeBuilder(AnalysisDriver driver) = DartChangeBuilderImpl; |
| 26 |
| 27 @override |
| 28 Future<Null> addFileEdit(String path, int fileStamp, |
| 29 void buildFileEdit(DartFileEditBuilder builder)); |
24 } | 30 } |
25 | 31 |
26 /** | 32 /** |
27 * An [EditBuilder] used to build edits in Dart files. | 33 * An [EditBuilder] used to build edits in Dart files. |
28 * | 34 * |
29 * Clients may not extend, implement or mix-in this class. | 35 * Clients may not extend, implement or mix-in this class. |
30 */ | 36 */ |
31 abstract class DartEditBuilder extends EditBuilder { | 37 abstract class DartEditBuilder extends EditBuilder { |
| 38 @override |
| 39 void addLinkedEdit( |
| 40 String groupName, void buildLinkedEdit(DartLinkedEditBuilder builder)); |
| 41 |
32 /** | 42 /** |
33 * Write the code for a declaration of a class with the given [name]. If a | 43 * Write the code for a declaration of a class with the given [name]. If a |
34 * list of [interfaces] is provided, then the class will implement those | 44 * list of [interfaces] is provided, then the class will implement those |
35 * interfaces. If [isAbstract] is `true`, then the class will be abstract. If | 45 * interfaces. If [isAbstract] is `true`, then the class will be abstract. If |
36 * a [memberWriter] is provided, then it will be invoked to allow members to | 46 * a [memberWriter] is provided, then it will be invoked to allow members to |
37 * be generated. (The members will automatically be preceded and followed by | 47 * be generated. (The members will automatically be preceded and followed by |
38 * end-of-line markers.) If a list of [mixins] is provided, then the class | 48 * end-of-line markers.) If a list of [mixins] is provided, then the class |
39 * will mix in those classes. If a [nameGroupName] is provided, then the name | 49 * will mix in those classes. If a [nameGroupName] is provided, then the name |
40 * of the class will be included in the linked edit group with that name. If a | 50 * of the class will be included in the linked edit group with that name. If a |
41 * [superclass] is given then it will be the superclass of the class. (If a | 51 * [superclass] is given then it will be the superclass of the class. (If a |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 */ | 230 */ |
221 void writeTypeParameters(List<TypeParameterElement> typeParameters); | 231 void writeTypeParameters(List<TypeParameterElement> typeParameters); |
222 } | 232 } |
223 | 233 |
224 /** | 234 /** |
225 * A [FileEditBuilder] used to build edits for Dart files. | 235 * A [FileEditBuilder] used to build edits for Dart files. |
226 * | 236 * |
227 * Clients may not extend, implement or mix-in this class. | 237 * Clients may not extend, implement or mix-in this class. |
228 */ | 238 */ |
229 abstract class DartFileEditBuilder extends FileEditBuilder { | 239 abstract class DartFileEditBuilder extends FileEditBuilder { |
| 240 @override |
| 241 void addInsertion(int offset, void buildEdit(DartEditBuilder builder)); |
| 242 |
| 243 @override |
| 244 void addReplacement( |
| 245 SourceRange range, void buildEdit(DartEditBuilder builder)); |
| 246 |
230 /** | 247 /** |
231 * Create one or more edits that will convert the given function [body] from | 248 * Create one or more edits that will convert the given function [body] from |
232 * being synchronous to be asynchronous. This includes adding the `async` | 249 * being synchronous to be asynchronous. This includes adding the `async` |
233 * modifier to the body as well as potentially replacing the return type of | 250 * modifier to the body as well as potentially replacing the return type of |
234 * the function to `Future`. | 251 * the function to `Future`. |
235 * | 252 * |
236 * There is currently a limitation in that the function body must not be a | 253 * There is currently a limitation in that the function body must not be a |
237 * generator. | 254 * generator. |
238 * | 255 * |
239 * Throws an [ArgumentError] if the function body is not both synchronous and | 256 * Throws an [ArgumentError] if the function body is not both synchronous and |
(...skipping 22 matching lines...) Expand all Loading... |
262 * | 279 * |
263 * Clients may not extend, implement or mix-in this class. | 280 * Clients may not extend, implement or mix-in this class. |
264 */ | 281 */ |
265 abstract class DartLinkedEditBuilder extends LinkedEditBuilder { | 282 abstract class DartLinkedEditBuilder extends LinkedEditBuilder { |
266 /** | 283 /** |
267 * Add the given [type] and all of its supertypes (other than mixins) as | 284 * Add the given [type] and all of its supertypes (other than mixins) as |
268 * suggestions for the current linked edit group. | 285 * suggestions for the current linked edit group. |
269 */ | 286 */ |
270 void addSuperTypesAsSuggestions(DartType type); | 287 void addSuperTypesAsSuggestions(DartType type); |
271 } | 288 } |
OLD | NEW |