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

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

Issue 1838933003: Format code in analysis_server (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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
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 /** 5 /**
6 * Code for reading an HTML API description. 6 * Code for reading an HTML API description.
7 */ 7 */
8 library from.html; 8 library from.html;
9 9
10 import 'dart:io'; 10 import 'dart:io';
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 * </type> 416 * </type>
417 * 417 *
418 * Where TYPE is any HTML that can be parsed by [typeDeclFromHtml]. 418 * Where TYPE is any HTML that can be parsed by [typeDeclFromHtml].
419 * 419 *
420 * Child elements can occur in any order. 420 * Child elements can occur in any order.
421 */ 421 */
422 TypeDefinition typeDefinitionFromHtml(dom.Element html) { 422 TypeDefinition typeDefinitionFromHtml(dom.Element html) {
423 checkName(html, 'type'); 423 checkName(html, 'type');
424 String name = html.attributes['name']; 424 String name = html.attributes['name'];
425 String context = name != null ? name : 'type'; 425 String context = name != null ? name : 'type';
426 checkAttributes(html, ['name'], context, optionalAttributes: ['experimental']) ; 426 checkAttributes(html, ['name'], context,
427 optionalAttributes: ['experimental']);
427 TypeDecl type = processContentsAsType(html, context); 428 TypeDecl type = processContentsAsType(html, context);
428 bool experimental = html.attributes['experimental'] == 'true'; 429 bool experimental = html.attributes['experimental'] == 'true';
429 return new TypeDefinition(name, type, html, experimental: experimental); 430 return new TypeDefinition(name, type, html, experimental: experimental);
430 } 431 }
431 432
432 /** 433 /**
433 * Create a [TypeEnum] from an HTML description. 434 * Create a [TypeEnum] from an HTML description.
434 */ 435 */
435 TypeEnum typeEnumFromHtml(dom.Element html, String context) { 436 TypeEnum typeEnumFromHtml(dom.Element html, String context) {
436 checkName(html, 'enum', context); 437 checkName(html, 'enum', context);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 String value = html.attributes['value']; 511 String value = html.attributes['value'];
511 TypeDecl type = processContentsAsType(html, context); 512 TypeDecl type = processContentsAsType(html, context);
512 return new TypeObjectField(name, type, html, 513 return new TypeObjectField(name, type, html,
513 optional: optional, value: value); 514 optional: optional, value: value);
514 } 515 }
515 516
516 /** 517 /**
517 * Create a [TypeObject] from an HTML description. 518 * Create a [TypeObject] from an HTML description.
518 */ 519 */
519 TypeObject typeObjectFromHtml(dom.Element html, String context) { 520 TypeObject typeObjectFromHtml(dom.Element html, String context) {
520 checkAttributes(html, [], context, optionalAttributes: ['experimental']); 521 checkAttributes(html, [], context, optionalAttributes: ['experimental']);
521 List<TypeObjectField> fields = <TypeObjectField>[]; 522 List<TypeObjectField> fields = <TypeObjectField>[];
522 recurse(html, context, { 523 recurse(html, context, {
523 'field': (dom.Element child) { 524 'field': (dom.Element child) {
524 fields.add(typeObjectFieldFromHtml(child, context)); 525 fields.add(typeObjectFieldFromHtml(child, context));
525 } 526 }
526 }); 527 });
527 bool experimental = html.attributes['experimental'] == 'true'; 528 bool experimental = html.attributes['experimental'] == 'true';
528 return new TypeObject(fields, html, experimental: experimental); 529 return new TypeObject(fields, html, experimental: experimental);
529 } 530 }
530 531
(...skipping 14 matching lines...) Expand all
545 TypeDefinition typeDefinition = typeDefinitionFromHtml(child); 546 TypeDefinition typeDefinition = typeDefinitionFromHtml(child);
546 types[typeDefinition.name] = typeDefinition; 547 types[typeDefinition.name] = typeDefinition;
547 } 548 }
548 }); 549 });
549 return new Types(types, html); 550 return new Types(types, html);
550 } 551 }
551 552
552 typedef void ElementProcessor(dom.Element element); 553 typedef void ElementProcessor(dom.Element element);
553 554
554 typedef void TextProcessor(dom.Text text); 555 typedef void TextProcessor(dom.Text text);
OLDNEW
« no previous file with comments | « pkg/analysis_server/tool/spec/codegen_java_types.dart ('k') | pkg/analysis_server/tool/spec/to_html.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698