OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 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. |
| 4 |
| 5 library analysis_server.utilities.change_builder_dart; |
| 6 |
| 7 import 'package:analysis_server/src/utilities/change_builder_dart.dart'; |
| 8 import 'package:analysis_server/utilities/change_builder_core.dart'; |
| 9 import 'package:analyzer/src/generated/ast.dart'; |
| 10 import 'package:analyzer/src/generated/element.dart'; |
| 11 import 'package:analyzer/src/generated/engine.dart'; |
| 12 |
| 13 /** |
| 14 * A [ChangeBuilder] used to build changes in Dart files. |
| 15 * |
| 16 * Clients are not expected to subtype this class. |
| 17 */ |
| 18 abstract class DartChangeBuilder extends ChangeBuilder { |
| 19 /** |
| 20 * Initialize a newly created change builder. |
| 21 */ |
| 22 factory DartChangeBuilder(AnalysisContext context) = DartChangeBuilderImpl; |
| 23 } |
| 24 |
| 25 /** |
| 26 * An [EditBuilder] used to build edits in Dart files. |
| 27 * |
| 28 * Clients are not expected to subtype this class. |
| 29 */ |
| 30 abstract class DartEditBuilder extends EditBuilder { |
| 31 /** |
| 32 * The group-id used for the name of a declaration. |
| 33 */ |
| 34 static const String NAME_GROUP_ID = 'NAME'; |
| 35 |
| 36 /** |
| 37 * The group-id used for the return type of a function, getter or method. |
| 38 */ |
| 39 static const String RETURN_TYPE_GROUP_ID = 'RETURN_TYPE'; |
| 40 |
| 41 /** |
| 42 * The group-id used for the name of the superclass in a class declaration. |
| 43 */ |
| 44 static const String SUPERCLASS_GROUP_ID = 'SUPERCLASS'; |
| 45 |
| 46 /** |
| 47 * Write the code for a declaration of a class with the given [name]. If |
| 48 * [isAbstract] is `true`, then the class will be abstract. If a [superclass] |
| 49 * is given then it will be the superclass of the class. |
| 50 */ |
| 51 void writeClassDeclaration(String name, |
| 52 {bool isAbstract: false, DartType superclass}); |
| 53 |
| 54 /** |
| 55 * Append a placeholder for an override of an inherited [member]. |
| 56 */ |
| 57 void writeOverrideOfInheritedMember(ExecutableElement member); |
| 58 |
| 59 /** |
| 60 * Write the code for a list of [parameters], including the surrounding |
| 61 * parentheses. |
| 62 */ |
| 63 void writeParameters(Iterable<ParameterElement> parameters); |
| 64 |
| 65 /** |
| 66 * Write the code for a list of parameters that would match the given list of |
| 67 * [arguments], including the surrounding parentheses. |
| 68 */ |
| 69 void writeParametersMatchingArguments(ArgumentList arguments); |
| 70 |
| 71 /** |
| 72 * Write the code for a single parameter with the given [type] and [name]. |
| 73 * The [type] can be `null` if no type is to be specified for the parameter. |
| 74 */ |
| 75 void writeParameterSource(DartType type, String name); |
| 76 |
| 77 /** |
| 78 * Write the code for a type annotation for the given [type]. If the [type] is |
| 79 * either `null` or represents the type 'dynamic', then the behavior depends |
| 80 * on whether a type is [required]. If [required] is `true`, then 'var' will |
| 81 * be written; otherwise, nothing is written. |
| 82 * |
| 83 * If the [groupName] is not `null`, then the name of the type (including type |
| 84 * parameters) will be included as a region in the linked edit group with that |
| 85 * name. If the [groupName] is not `null` and [addSupertypeProposals] is |
| 86 * `true`, then all of the supertypes of the [type] will be added as |
| 87 * suggestions for alternatives to the type name. |
| 88 */ |
| 89 bool writeType(DartType type, |
| 90 {bool addSupertypeProposals: false, String groupName, bool required: false
}); |
| 91 } |
| 92 |
| 93 /** |
| 94 * A [FileEditBuilder] used to build edits for Dart files. |
| 95 * |
| 96 * Clients are not expected to subtype this class. |
| 97 */ |
| 98 abstract class DartFileEditBuilder extends FileEditBuilder {} |
OLD | NEW |