OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 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 | 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 library analysis_server.utilities.change_builder_dart; | 5 library analysis_server.utilities.change_builder_dart; |
6 | 6 |
7 import 'package:analysis_server/src/utilities/change_builder_dart.dart'; | 7 import 'package:analysis_server/src/utilities/change_builder_dart.dart'; |
8 import 'package:analysis_server/utilities/change_builder_core.dart'; | 8 import 'package:analysis_server/utilities/change_builder_core.dart'; |
9 import 'package:analyzer/src/generated/ast.dart'; | 9 import 'package:analyzer/src/generated/ast.dart'; |
10 import 'package:analyzer/src/generated/element.dart'; | 10 import 'package:analyzer/src/generated/element.dart'; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 * interfaces. If [isAbstract] is `true`, then the class will be abstract. If | 49 * interfaces. If [isAbstract] is `true`, then the class will be abstract. If |
50 * a [memberWriter] is provided, then it will be invoked to allow members to | 50 * a [memberWriter] is provided, then it will be invoked to allow members to |
51 * be generated. (The members will automatically be preceeded and followed by | 51 * be generated. (The members will automatically be preceeded and followed by |
52 * end-of-line markers.) If a list of [mixins] is provided, then the class | 52 * end-of-line markers.) If a list of [mixins] is provided, then the class |
53 * will mix in those classes. If a [nameGroupName] is provided, then the name | 53 * will mix in those classes. If a [nameGroupName] is provided, then the name |
54 * of the class will be included in the linked edit group with that name. If a | 54 * of the class will be included in the linked edit group with that name. If a |
55 * [superclass] is given then it will be the superclass of the class. (If a | 55 * [superclass] is given then it will be the superclass of the class. (If a |
56 * list of [mixins] is provided but no [superclass] is given then the class | 56 * list of [mixins] is provided but no [superclass] is given then the class |
57 * will extend `Object`.) | 57 * will extend `Object`.) |
58 */ | 58 */ |
59 void writeClassDeclaration(String name, {Iterable<DartType> interfaces, | 59 void writeClassDeclaration(String name, |
60 bool isAbstract: false, void memberWriter(), Iterable<DartType> mixins, | 60 {Iterable<DartType> interfaces, |
61 String nameGroupName, DartType superclass}); | 61 bool isAbstract: false, |
| 62 void memberWriter(), |
| 63 Iterable<DartType> mixins, |
| 64 String nameGroupName, |
| 65 DartType superclass}); |
62 | 66 |
63 /** | 67 /** |
64 * Write the code for a declaration of a field with the given [name]. If an | 68 * Write the code for a declaration of a field with the given [name]. If an |
65 * [initializerWriter] is provided, it will be invoked to write the content of | 69 * [initializerWriter] is provided, it will be invoked to write the content of |
66 * the initializer. (The equal sign separating the field name from the | 70 * the initializer. (The equal sign separating the field name from the |
67 * initializer expression will automatically be written.) If [isConst] is | 71 * initializer expression will automatically be written.) If [isConst] is |
68 * `true`, then the declaration will be preceeded by the `const` keyword. If | 72 * `true`, then the declaration will be preceeded by the `const` keyword. If |
69 * [isFinal] is `true`, then the declaration will be preceeded by the `final` | 73 * [isFinal] is `true`, then the declaration will be preceeded by the `final` |
70 * keyword. (If both [isConst] and [isFinal] are `true`, then only the `const` | 74 * keyword. (If both [isConst] and [isFinal] are `true`, then only the `const` |
71 * keyword will be written.) If [isStatic] is `true`, then the declaration | 75 * keyword will be written.) If [isStatic] is `true`, then the declaration |
72 * will be preceeded by the `static` keyword. If a [nameGroupName] is | 76 * will be preceeded by the `static` keyword. If a [nameGroupName] is |
73 * provided, the name of the field will be included in the linked edit group | 77 * provided, the name of the field will be included in the linked edit group |
74 * with that name. If a [type] is provided, then it will be used as the type | 78 * with that name. If a [type] is provided, then it will be used as the type |
75 * of the field. (The keyword `var` will be provided automatically when | 79 * of the field. (The keyword `var` will be provided automatically when |
76 * required.) If a [typeGroupName] is provided, then if a type was written | 80 * required.) If a [typeGroupName] is provided, then if a type was written |
77 * it will be in the linked edit group with that name. | 81 * it will be in the linked edit group with that name. |
78 */ | 82 */ |
79 void writeFieldDeclaration(String name, {void initializerWriter(), | 83 void writeFieldDeclaration(String name, |
80 bool isConst: false, bool isFinal: false, bool isStatic: false, | 84 {void initializerWriter(), |
81 String nameGroupName, DartType type, String typeGroupName}); | 85 bool isConst: false, |
| 86 bool isFinal: false, |
| 87 bool isStatic: false, |
| 88 String nameGroupName, |
| 89 DartType type, |
| 90 String typeGroupName}); |
82 | 91 |
83 /** | 92 /** |
84 * Write the code for a declaration of a getter with the given [name]. If a | 93 * Write the code for a declaration of a getter with the given [name]. If a |
85 * [bodyWriter] is provided, it will be invoked to write the body of the | 94 * [bodyWriter] is provided, it will be invoked to write the body of the |
86 * getter. (The space between the name and the body will automatically be | 95 * getter. (The space between the name and the body will automatically be |
87 * written.) If [isStatic] is `true`, then the declaration will be preceeded | 96 * written.) If [isStatic] is `true`, then the declaration will be preceeded |
88 * by the `static` keyword. If a [nameGroupName] is provided, the name of the | 97 * by the `static` keyword. If a [nameGroupName] is provided, the name of the |
89 * getter will be included in the linked edit group with that name. If a | 98 * getter will be included in the linked edit group with that name. If a |
90 * [returnType] is provided, then it will be used as the return type of the | 99 * [returnType] is provided, then it will be used as the return type of the |
91 * getter. If a [returnTypeGroupName] is provided, then if a return type was | 100 * getter. If a [returnTypeGroupName] is provided, then if a return type was |
92 * written it will be in the linked edit group with that name. | 101 * written it will be in the linked edit group with that name. |
93 */ | 102 */ |
94 void writeGetterDeclaration(String name, {void bodyWriter(), | 103 void writeGetterDeclaration(String name, |
95 bool isStatic: false, String nameGroupName, DartType returnType, | 104 {void bodyWriter(), |
| 105 bool isStatic: false, |
| 106 String nameGroupName, |
| 107 DartType returnType, |
96 String returnTypeGroupName}); | 108 String returnTypeGroupName}); |
97 | 109 |
98 /** | 110 /** |
99 * Append a placeholder for an override of the specified inherited [member]. | 111 * Append a placeholder for an override of the specified inherited [member]. |
100 */ | 112 */ |
101 void writeOverrideOfInheritedMember(ExecutableElement member); | 113 void writeOverrideOfInheritedMember(ExecutableElement member); |
102 | 114 |
103 /** | 115 /** |
104 * Write the code for a list of [parameters], including the surrounding | 116 * Write the code for a list of [parameters], including the surrounding |
105 * parentheses. | 117 * parentheses. |
(...skipping 17 matching lines...) Expand all Loading... |
123 * either `null` or represents the type 'dynamic', then the behavior depends | 135 * either `null` or represents the type 'dynamic', then the behavior depends |
124 * on whether a type is [required]. If [required] is `true`, then 'var' will | 136 * on whether a type is [required]. If [required] is `true`, then 'var' will |
125 * be written; otherwise, nothing is written. | 137 * be written; otherwise, nothing is written. |
126 * | 138 * |
127 * If the [groupName] is not `null`, then the name of the type (including type | 139 * If the [groupName] is not `null`, then the name of the type (including type |
128 * parameters) will be included as a region in the linked edit group with that | 140 * parameters) will be included as a region in the linked edit group with that |
129 * name. If the [groupName] is not `null` and [addSupertypeProposals] is | 141 * name. If the [groupName] is not `null` and [addSupertypeProposals] is |
130 * `true`, then all of the supertypes of the [type] will be added as | 142 * `true`, then all of the supertypes of the [type] will be added as |
131 * suggestions for alternatives to the type name. | 143 * suggestions for alternatives to the type name. |
132 */ | 144 */ |
133 bool writeType(DartType type, {bool addSupertypeProposals: false, | 145 bool writeType(DartType type, |
134 String groupName, bool required: false}); | 146 {bool addSupertypeProposals: false, |
| 147 String groupName, |
| 148 bool required: false}); |
135 } | 149 } |
136 | 150 |
137 /** | 151 /** |
138 * A [FileEditBuilder] used to build edits for Dart files. | 152 * A [FileEditBuilder] used to build edits for Dart files. |
139 * | 153 * |
140 * Clients are not expected to subtype this class. | 154 * Clients are not expected to subtype this class. |
141 */ | 155 */ |
142 abstract class DartFileEditBuilder extends FileEditBuilder {} | 156 abstract class DartFileEditBuilder extends FileEditBuilder {} |
OLD | NEW |