Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: pkg/analysis_server/lib/utilities/change_builder_dart.dart

Issue 1117183004: More source utilities (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 26 matching lines...) Expand all
37 * The group-id used for the return type of a function, getter or method. 37 * The group-id used for the return type of a function, getter or method.
38 */ 38 */
39 static const String RETURN_TYPE_GROUP_ID = 'RETURN_TYPE'; 39 static const String RETURN_TYPE_GROUP_ID = 'RETURN_TYPE';
40 40
41 /** 41 /**
42 * The group-id used for the name of the superclass in a class declaration. 42 * The group-id used for the name of the superclass in a class declaration.
43 */ 43 */
44 static const String SUPERCLASS_GROUP_ID = 'SUPERCLASS'; 44 static const String SUPERCLASS_GROUP_ID = 'SUPERCLASS';
45 45
46 /** 46 /**
47 * Write the code for a declaration of a class with the given [name]. If 47 * Write the code for a declaration of a class with the given [name]. If a
48 * [isAbstract] is `true`, then the class will be abstract. If a [superclass] 48 * list of [interfaces] is provided, then the class will implement those
49 * is given then it will be the superclass of the class. 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
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
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
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
57 * will extend `Object`.)
50 */ 58 */
51 void writeClassDeclaration(String name, 59 void writeClassDeclaration(String name, {Iterable<DartType> interfaces,
52 {bool isAbstract: false, DartType superclass}); 60 bool isAbstract: false, void memberWriter(), Iterable<DartType> mixins,
61 String nameGroupName, DartType superclass});
53 62
54 /** 63 /**
55 * Append a placeholder for an override of an inherited [member]. 64 * 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
66 * the initializer. (The equal sign separating the field name from the
67 * initializer expression will automatically be written.) If [isConst] is
68 * `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`
70 * keyword. (If both [isConst] and [isFinal] are `true`, then only the `const`
71 * keyword will be written.) If [isStatic] is `true`, then the declaration
72 * 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
74 * 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
76 * required.) If a [typeGroupName] is provided, then if a type was written
77 * it will be in the linked edit group with that name.
78 */
79 void writeFieldDeclaration(String name, {void initializerWriter(),
80 bool isConst: false, bool isFinal: false, bool isStatic: false,
81 String nameGroupName, DartType type, String typeGroupName});
82
83 /**
84 * 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
86 * getter. (The space between the name and the body will automatically be
87 * 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
89 * 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
91 * 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.
93 */
94 void writeGetterDeclaration(String name, {void bodyWriter(),
95 bool isStatic: false, String nameGroupName, DartType returnType,
96 String returnTypeGroupName});
97
98 /**
99 * Append a placeholder for an override of the specified inherited [member].
56 */ 100 */
57 void writeOverrideOfInheritedMember(ExecutableElement member); 101 void writeOverrideOfInheritedMember(ExecutableElement member);
58 102
59 /** 103 /**
60 * Write the code for a list of [parameters], including the surrounding 104 * Write the code for a list of [parameters], including the surrounding
61 * parentheses. 105 * parentheses.
62 */ 106 */
63 void writeParameters(Iterable<ParameterElement> parameters); 107 void writeParameters(Iterable<ParameterElement> parameters);
64 108
65 /** 109 /**
(...skipping 13 matching lines...) Expand all
79 * either `null` or represents the type 'dynamic', then the behavior depends 123 * 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 124 * on whether a type is [required]. If [required] is `true`, then 'var' will
81 * be written; otherwise, nothing is written. 125 * be written; otherwise, nothing is written.
82 * 126 *
83 * If the [groupName] is not `null`, then the name of the type (including type 127 * 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 128 * 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 129 * name. If the [groupName] is not `null` and [addSupertypeProposals] is
86 * `true`, then all of the supertypes of the [type] will be added as 130 * `true`, then all of the supertypes of the [type] will be added as
87 * suggestions for alternatives to the type name. 131 * suggestions for alternatives to the type name.
88 */ 132 */
89 bool writeType(DartType type, 133 bool writeType(DartType type, {bool addSupertypeProposals: false,
90 {bool addSupertypeProposals: false, String groupName, bool required: false }); 134 String groupName, bool required: false});
91 } 135 }
92 136
93 /** 137 /**
94 * A [FileEditBuilder] used to build edits for Dart files. 138 * A [FileEditBuilder] used to build edits for Dart files.
95 * 139 *
96 * Clients are not expected to subtype this class. 140 * Clients are not expected to subtype this class.
97 */ 141 */
98 abstract class DartFileEditBuilder extends FileEditBuilder {} 142 abstract class DartFileEditBuilder extends FileEditBuilder {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698