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

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

Issue 1110583002: Add utilities for creating SourceChanges (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
(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.
Paul Berry 2015/04/27 16:30:10 It would be nice if we could find a way to make th
Brian Wilkerson 2015/04/28 15:17:00 I like that idea! I'm not sure what the signature
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 void writeConstructorDeclaration(ClassElement classElement,
55 {ArgumentList argumentList, SimpleIdentifier constructorName,
56 bool isConst: false});
57
58 /**
59 * Append a placeholder for an override of an inherited [member].
60 */
61 void writeOverrideOfInheritedMember(ExecutableElement member);
62
63 /**
64 * Write the code for a list of [parameters], including the surrounding
65 * parentheses.
66 */
67 void writeParameters(List<ParameterElement> parameters);
68
69 /**
70 * Write the code for a list of parameters that would match the given list of
71 * [arguments], including the surrounding parentheses.
72 */
73 void writeParametersMatchingArguments(ArgumentList arguments);
74
75 /**
76 * Write the code for a single parameter with the given [type] and [name].
77 * The [type] can be `null` if no type is to be specified for the parameter.
78 */
79 void writeParameterSource(DartType type, String name);
80
81 /**
82 * Write the code for a type annotation for the given [type], unless the
83 * [type] is either `null` or represents the type 'dynamic'. If
84 * [addSupertypeProposals] is `true`, then all of the supertypes of the [type]
85 * will be added as suggestions for alternatives to the type name. If the
86 * [groupName] is not `null`, then the name of the type (including type
87 * parameters) will be included as a region in the linked edit group with that
88 * name. If [orVar] is `true`, then then write 'var' if the type name is not
89 * written.
90 */
91 bool writeType(DartType type,
92 {bool addSupertypeProposals: false, String groupName, bool orVar: false});
93 }
94
95 /**
96 * A [FileEditBuilder] used to build edits for Dart files.
97 *
98 * Clients are not expected to subtype this class.
99 */
100 abstract class DartFileEditBuilder extends FileEditBuilder {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698