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

Side by Side Diff: pkg/analysis_server/tool/spec/codegen_dart_protocol.dart

Issue 530033002: Use a more precise type for "object" in analysis server API. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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
« no previous file with comments | « pkg/analysis_server/test/edit/refactoring_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 codegen.protocol; 5 library codegen.protocol;
6 6
7 import 'dart:convert'; 7 import 'dart:convert';
8 8
9 import 'api.dart'; 9 import 'api.dart';
10 import 'codegen_tools.dart'; 10 import 'codegen_tools.dart';
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 typedef void CodegenCallback(); 183 typedef void CodegenCallback();
184 184
185 /** 185 /**
186 * Visitor which produces Dart code representing the API. 186 * Visitor which produces Dart code representing the API.
187 */ 187 */
188 class CodegenProtocolVisitor extends HierarchicalApiVisitor with CodeGenerator { 188 class CodegenProtocolVisitor extends HierarchicalApiVisitor with CodeGenerator {
189 /** 189 /**
190 * Type references in the spec that are named something else in Dart. 190 * Type references in the spec that are named something else in Dart.
191 */ 191 */
192 static const Map<String, String> _typeRenames = const { 192 static const Map<String, String> _typeRenames = const {
193 'object': 'Object', 193 'object': 'Map',
194 }; 194 };
195 195
196 /** 196 /**
197 * Class members for which the constructor argument should be optional, even 197 * Class members for which the constructor argument should be optional, even
198 * if the member is not an optional part of the protocol. For list types, 198 * if the member is not an optional part of the protocol. For list types,
199 * the constructor will default the member to the empty list. 199 * the constructor will default the member to the empty list.
200 */ 200 */
201 static const Map<String, List<String>> _optionalConstructorArguments = const { 201 static const Map<String, List<String>> _optionalConstructorArguments = const {
202 'ErrorFixes': const ['fixes'], 202 'ErrorFixes': const ['fixes'],
203 'SourceChange': const ['edits', 'linkedEditGroups'], 203 'SourceChange': const ['edits', 'linkedEditGroups'],
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 void emitObjectClass(String className, TypeObject type, 284 void emitObjectClass(String className, TypeObject type,
285 ImpliedType impliedType) { 285 ImpliedType impliedType) {
286 docComment(toHtmlVisitor.collectHtml(() { 286 docComment(toHtmlVisitor.collectHtml(() {
287 toHtmlVisitor.p(() { 287 toHtmlVisitor.p(() {
288 toHtmlVisitor.write(impliedType.humanReadableName); 288 toHtmlVisitor.write(impliedType.humanReadableName);
289 }); 289 });
290 if (impliedType.type != null) { 290 if (impliedType.type != null) {
291 toHtmlVisitor.showType(null, impliedType.type); 291 toHtmlVisitor.showType(null, impliedType.type);
292 } 292 }
293 })); 293 }));
294 writeln('class $className {'); 294 writeln('class $className implements HasToJson {');
295 indent(() { 295 indent(() {
296 if (emitSpecialStaticMembers(className)) { 296 if (emitSpecialStaticMembers(className)) {
297 writeln(); 297 writeln();
298 } 298 }
299 for (TypeObjectField field in type.fields) { 299 for (TypeObjectField field in type.fields) {
300 if (field.value != null) { 300 if (field.value != null) {
301 continue; 301 continue;
302 } 302 }
303 docComment(toHtmlVisitor.collectHtml(() { 303 docComment(toHtmlVisitor.collectHtml(() {
304 toHtmlVisitor.translateHtml(field.html); 304 toHtmlVisitor.translateHtml(field.html);
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after
1266 CodegenProtocolVisitor visitor = new CodegenProtocolVisitor(readApi()); 1266 CodegenProtocolVisitor visitor = new CodegenProtocolVisitor(readApi());
1267 return visitor.collectCode(visitor.visitApi); 1267 return visitor.collectCode(visitor.visitApi);
1268 }); 1268 });
1269 1269
1270 /** 1270 /**
1271 * Translate spec_input.html into protocol_matchers.dart. 1271 * Translate spec_input.html into protocol_matchers.dart.
1272 */ 1272 */
1273 main() { 1273 main() {
1274 target.generate(); 1274 target.generate();
1275 } 1275 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/edit/refactoring_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698