| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 * **docgen** is a tool for creating machine readable representations of Dart | 6 * **docgen** is a tool for creating machine readable representations of Dart |
| 7 * code metadata, including: classes, members, comments and annotations. | 7 * code metadata, including: classes, members, comments and annotations. |
| 8 * | 8 * |
| 9 * docgen is run on a `.dart` file or a directory containing `.dart` files. | 9 * docgen is run on a `.dart` file or a directory containing `.dart` files. |
| 10 * | 10 * |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 bool isError(String qualifiedName) { | 463 bool isError(String qualifiedName) { |
| 464 return qualifiedName.toLowerCase().contains('error') || | 464 return qualifiedName.toLowerCase().contains('error') || |
| 465 qualifiedName.toLowerCase().contains('exception'); | 465 qualifiedName.toLowerCase().contains('exception'); |
| 466 } | 466 } |
| 467 | 467 |
| 468 /** | 468 /** |
| 469 * A class representing all programming constructs, like library or class. | 469 * A class representing all programming constructs, like library or class. |
| 470 */ | 470 */ |
| 471 class Indexable { | 471 class Indexable { |
| 472 String name; | 472 String name; |
| 473 String qualifiedName; |
| 473 | 474 |
| 474 /// Documentation comment with converted markdown. | 475 /// Documentation comment with converted markdown. |
| 475 String comment; | 476 String comment; |
| 476 | 477 |
| 477 Indexable(this.name, this.comment, String qualifiedName) { | 478 Indexable(this.name, this.comment, String qualifiedName) { |
| 479 this.qualifiedName = qualifiedName; |
| 478 qualifiedNameIndex.add(qualifiedName); | 480 qualifiedNameIndex.add(qualifiedName); |
| 479 } | 481 } |
| 480 } | 482 } |
| 481 | 483 |
| 482 /** | 484 /** |
| 483 * A class containing contents of a Dart library. | 485 * A class containing contents of a Dart library. |
| 484 */ | 486 */ |
| 485 class Library extends Indexable { | 487 class Library extends Indexable { |
| 486 | 488 |
| 487 /// Top-level variables in the library. | 489 /// Top-level variables in the library. |
| 488 Map<String, Variable> variables; | 490 Map<String, Variable> variables; |
| 489 | 491 |
| 490 /// Top-level functions in the library. | 492 /// Top-level functions in the library. |
| 491 Map<String, Map<String, Method>> functions; | 493 Map<String, Map<String, Method>> functions; |
| 492 | 494 |
| 493 /// Classes defined within the library | 495 /// Classes defined within the library |
| 494 Map<String, Class> classes; | 496 Map<String, Class> classes; |
| 495 | 497 |
| 496 Library(String name, String comment, this.variables, | 498 Library(String name, String comment, this.variables, |
| 497 this.functions, this.classes) : super(name, comment, name) {} | 499 this.functions, this.classes) : super(name, comment, name) {} |
| 498 | 500 |
| 499 /// Generates a map describing the [Library] object. | 501 /// Generates a map describing the [Library] object. |
| 500 Map toMap() => { | 502 Map toMap() => { |
| 501 'name': name, | 503 'name': name, |
| 504 'qualifiedname': qualifiedName, |
| 502 'comment': comment, | 505 'comment': comment, |
| 503 'variables': recurseMap(variables), | 506 'variables': recurseMap(variables), |
| 504 'functions': recurseMap(functions), | 507 'functions': recurseMap(functions), |
| 505 'classes': recurseMap(classes) | 508 'classes': recurseMap(classes) |
| 506 }; | 509 }; |
| 507 } | 510 } |
| 508 | 511 |
| 509 /** | 512 /** |
| 510 * A class containing contents of a Dart class. | 513 * A class containing contents of a Dart class. |
| 511 */ | 514 */ |
| (...skipping 17 matching lines...) Expand all Loading... |
| 529 /// List of the meta annotations on the class. | 532 /// List of the meta annotations on the class. |
| 530 List<String> annotations; | 533 List<String> annotations; |
| 531 | 534 |
| 532 Class(String name, this.superclass, String comment, this.interfaces, | 535 Class(String name, this.superclass, String comment, this.interfaces, |
| 533 this.variables, this.methods, this.annotations, this.generics, | 536 this.variables, this.methods, this.annotations, this.generics, |
| 534 String qualifiedName) : super(name, comment, qualifiedName) {} | 537 String qualifiedName) : super(name, comment, qualifiedName) {} |
| 535 | 538 |
| 536 /// Generates a map describing the [Class] object. | 539 /// Generates a map describing the [Class] object. |
| 537 Map toMap() => { | 540 Map toMap() => { |
| 538 'name': name, | 541 'name': name, |
| 542 'qualifiedname': qualifiedName, |
| 539 'comment': comment, | 543 'comment': comment, |
| 540 'superclass': superclass, | 544 'superclass': superclass, |
| 541 'implements': new List.from(interfaces), | 545 'implements': new List.from(interfaces), |
| 542 'variables': recurseMap(variables), | 546 'variables': recurseMap(variables), |
| 543 'methods': recurseMap(methods), | 547 'methods': recurseMap(methods), |
| 544 'annotations': new List.from(annotations), | 548 'annotations': new List.from(annotations), |
| 545 'generics': recurseMap(generics) | 549 'generics': recurseMap(generics) |
| 546 }; | 550 }; |
| 547 } | 551 } |
| 548 | 552 |
| 549 class Typedef extends Indexable { | 553 class Typedef extends Indexable { |
| 550 String returnType; | 554 String returnType; |
| 551 | 555 |
| 552 Map<String, Parameter> parameters; | 556 Map<String, Parameter> parameters; |
| 553 | 557 |
| 554 /// Generic information about the typedef. | 558 /// Generic information about the typedef. |
| 555 Map<String, Generic> generics; | 559 Map<String, Generic> generics; |
| 556 | 560 |
| 557 /// List of the meta annotations on the typedef. | 561 /// List of the meta annotations on the typedef. |
| 558 List<String> annotations; | 562 List<String> annotations; |
| 559 | 563 |
| 560 Typedef(String name, this.returnType, String comment, this.generics, | 564 Typedef(String name, this.returnType, String comment, this.generics, |
| 561 this.parameters, this.annotations, | 565 this.parameters, this.annotations, |
| 562 String qualifiedName) : super(name, comment, qualifiedName) {} | 566 String qualifiedName) : super(name, comment, qualifiedName) {} |
| 563 | 567 |
| 564 Map toMap() => { | 568 Map toMap() => { |
| 565 'name': name, | 569 'name': name, |
| 570 'qualifiedname': qualifiedName, |
| 566 'comment': comment, | 571 'comment': comment, |
| 567 'return': returnType, | 572 'return': returnType, |
| 568 'parameters': recurseMap(parameters), | 573 'parameters': recurseMap(parameters), |
| 569 'annotations': new List.from(annotations), | 574 'annotations': new List.from(annotations), |
| 570 'generics': recurseMap(generics) | 575 'generics': recurseMap(generics) |
| 571 }; | 576 }; |
| 572 } | 577 } |
| 573 | 578 |
| 574 /** | 579 /** |
| 575 * A class containing properties of a Dart variable. | 580 * A class containing properties of a Dart variable. |
| 576 */ | 581 */ |
| 577 class Variable extends Indexable { | 582 class Variable extends Indexable { |
| 578 | 583 |
| 579 bool isFinal; | 584 bool isFinal; |
| 580 bool isStatic; | 585 bool isStatic; |
| 581 bool isConst; | 586 bool isConst; |
| 582 String type; | 587 String type; |
| 583 | 588 |
| 584 /// List of the meta annotations on the variable. | 589 /// List of the meta annotations on the variable. |
| 585 List<String> annotations; | 590 List<String> annotations; |
| 586 | 591 |
| 587 Variable(String name, this.isFinal, this.isStatic, this.isConst, this.type, | 592 Variable(String name, this.isFinal, this.isStatic, this.isConst, this.type, |
| 588 String comment, this.annotations, String qualifiedName) : super(name, | 593 String comment, this.annotations, String qualifiedName) : super(name, |
| 589 comment, qualifiedName); | 594 comment, qualifiedName); |
| 590 | 595 |
| 591 /// Generates a map describing the [Variable] object. | 596 /// Generates a map describing the [Variable] object. |
| 592 Map toMap() => { | 597 Map toMap() => { |
| 593 'name': name, | 598 'name': name, |
| 599 'qualifiedname': qualifiedName, |
| 594 'comment': comment, | 600 'comment': comment, |
| 595 'final': isFinal.toString(), | 601 'final': isFinal.toString(), |
| 596 'static': isStatic.toString(), | 602 'static': isStatic.toString(), |
| 597 'constant': isConst.toString(), | 603 'constant': isConst.toString(), |
| 598 'type': type, | 604 'type': type, |
| 599 'annotations': new List.from(annotations) | 605 'annotations': new List.from(annotations) |
| 600 }; | 606 }; |
| 601 } | 607 } |
| 602 | 608 |
| 603 /** | 609 /** |
| (...skipping 13 matching lines...) Expand all Loading... |
| 617 List<String> annotations; | 623 List<String> annotations; |
| 618 | 624 |
| 619 Method(String name, this.isStatic, this.isAbstract, this.isConst, | 625 Method(String name, this.isStatic, this.isAbstract, this.isConst, |
| 620 this.returnType, String comment, this.parameters, this.annotations, | 626 this.returnType, String comment, this.parameters, this.annotations, |
| 621 String qualifiedName) | 627 String qualifiedName) |
| 622 : super(name, comment, qualifiedName); | 628 : super(name, comment, qualifiedName); |
| 623 | 629 |
| 624 /// Generates a map describing the [Method] object. | 630 /// Generates a map describing the [Method] object. |
| 625 Map toMap() => { | 631 Map toMap() => { |
| 626 'name': name, | 632 'name': name, |
| 633 'qualifiedname': qualifiedName, |
| 627 'comment': comment, | 634 'comment': comment, |
| 628 'static': isStatic.toString(), | 635 'static': isStatic.toString(), |
| 629 'abstract': isAbstract.toString(), | 636 'abstract': isAbstract.toString(), |
| 630 'constant': isConst.toString(), | 637 'constant': isConst.toString(), |
| 631 'return': returnType, | 638 'return': returnType, |
| 632 'parameters': recurseMap(parameters), | 639 'parameters': recurseMap(parameters), |
| 633 'annotations': new List.from(annotations) | 640 'annotations': new List.from(annotations) |
| 634 }; | 641 }; |
| 635 } | 642 } |
| 636 | 643 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 String name; | 678 String name; |
| 672 String type; | 679 String type; |
| 673 | 680 |
| 674 Generic(this.name, this.type); | 681 Generic(this.name, this.type); |
| 675 | 682 |
| 676 Map toMap() => { | 683 Map toMap() => { |
| 677 'name': name, | 684 'name': name, |
| 678 'type': type | 685 'type': type |
| 679 }; | 686 }; |
| 680 } | 687 } |
| OLD | NEW |