| 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 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 /// Classes defined within the library | 538 /// Classes defined within the library |
| 539 ClassGroup classes; | 539 ClassGroup classes; |
| 540 | 540 |
| 541 Library(String name, String comment, this.variables, | 541 Library(String name, String comment, this.variables, |
| 542 this.functions, this.classes, bool isPrivate) : super(name, comment, | 542 this.functions, this.classes, bool isPrivate) : super(name, comment, |
| 543 name, isPrivate, "") {} | 543 name, isPrivate, "") {} |
| 544 | 544 |
| 545 /// Generates a map describing the [Library] object. | 545 /// Generates a map describing the [Library] object. |
| 546 Map toMap() => { | 546 Map toMap() => { |
| 547 'name': name, | 547 'name': name, |
| 548 'qualifiedname': qualifiedName, | 548 'qualifiedName': qualifiedName, |
| 549 'comment': comment, | 549 'comment': comment, |
| 550 'variables': recurseMap(variables), | 550 'variables': recurseMap(variables), |
| 551 'functions': functions.toMap(), | 551 'functions': functions.toMap(), |
| 552 'classes': classes.toMap() | 552 'classes': classes.toMap() |
| 553 }; | 553 }; |
| 554 } | 554 } |
| 555 | 555 |
| 556 /** | 556 /** |
| 557 * A class containing contents of a Dart class. | 557 * A class containing contents of a Dart class. |
| 558 */ | 558 */ |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 663 */ | 663 */ |
| 664 String validSuperclass() { | 664 String validSuperclass() { |
| 665 if (superclass == null) return 'dart.core.Object'; | 665 if (superclass == null) return 'dart.core.Object'; |
| 666 if (_isVisible(superclass)) return superclass.qualifiedName; | 666 if (_isVisible(superclass)) return superclass.qualifiedName; |
| 667 return superclass.validSuperclass(); | 667 return superclass.validSuperclass(); |
| 668 } | 668 } |
| 669 | 669 |
| 670 /// Generates a map describing the [Class] object. | 670 /// Generates a map describing the [Class] object. |
| 671 Map toMap() => { | 671 Map toMap() => { |
| 672 'name': name, | 672 'name': name, |
| 673 'qualifiedname': qualifiedName, | 673 'qualifiedName': qualifiedName, |
| 674 'comment': comment, | 674 'comment': comment, |
| 675 'superclass': validSuperclass(), | 675 'superclass': validSuperclass(), |
| 676 'implements': interfaces.where(_isVisible) | 676 'implements': interfaces.where(_isVisible) |
| 677 .map((e) => e.qualifiedName).toList(), | 677 .map((e) => e.qualifiedName).toList(), |
| 678 'subclass': subclasses.toList(), | 678 'subclass': subclasses.toList(), |
| 679 'variables': recurseMap(variables), | 679 'variables': recurseMap(variables), |
| 680 'inheritedvariables': recurseMap(inheritedVariables), | 680 'inheritedVariables': recurseMap(inheritedVariables), |
| 681 'methods': methods.toMap(), | 681 'methods': methods.toMap(), |
| 682 'inheritedmethods': inheritedMethods.toMap(), | 682 'inheritedMethods': inheritedMethods.toMap(), |
| 683 'annotations': annotations.map((a) => a.toMap()).toList(), | 683 'annotations': annotations.map((a) => a.toMap()).toList(), |
| 684 'generics': recurseMap(generics) | 684 'generics': recurseMap(generics) |
| 685 }; | 685 }; |
| 686 } | 686 } |
| 687 | 687 |
| 688 /** | 688 /** |
| 689 * A container to categorize classes into the following groups: abstract | 689 * A container to categorize classes into the following groups: abstract |
| 690 * classes, regular classes, typedefs, and errors. | 690 * classes, regular classes, typedefs, and errors. |
| 691 */ | 691 */ |
| 692 class ClassGroup { | 692 class ClassGroup { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 759 /// List of the meta annotations on the typedef. | 759 /// List of the meta annotations on the typedef. |
| 760 List<String> annotations; | 760 List<String> annotations; |
| 761 | 761 |
| 762 Typedef(String name, this.returnType, String comment, this.generics, | 762 Typedef(String name, this.returnType, String comment, this.generics, |
| 763 this.parameters, this.annotations, | 763 this.parameters, this.annotations, |
| 764 String qualifiedName, bool isPrivate, String owner) : super(name, comment, | 764 String qualifiedName, bool isPrivate, String owner) : super(name, comment, |
| 765 qualifiedName, isPrivate, owner) {} | 765 qualifiedName, isPrivate, owner) {} |
| 766 | 766 |
| 767 Map toMap() => { | 767 Map toMap() => { |
| 768 'name': name, | 768 'name': name, |
| 769 'qualifiedname': qualifiedName, | 769 'qualifiedName': qualifiedName, |
| 770 'comment': comment, | 770 'comment': comment, |
| 771 'return': returnType, | 771 'return': returnType, |
| 772 'parameters': recurseMap(parameters), | 772 'parameters': recurseMap(parameters), |
| 773 'annotations': annotations.map((a) => a.toMap()).toList(), | 773 'annotations': annotations.map((a) => a.toMap()).toList(), |
| 774 'generics': recurseMap(generics) | 774 'generics': recurseMap(generics) |
| 775 }; | 775 }; |
| 776 } | 776 } |
| 777 | 777 |
| 778 /** | 778 /** |
| 779 * A class containing properties of a Dart variable. | 779 * A class containing properties of a Dart variable. |
| 780 */ | 780 */ |
| 781 class Variable extends Indexable { | 781 class Variable extends Indexable { |
| 782 | 782 |
| 783 bool isFinal; | 783 bool isFinal; |
| 784 bool isStatic; | 784 bool isStatic; |
| 785 bool isConst; | 785 bool isConst; |
| 786 Type type; | 786 Type type; |
| 787 | 787 |
| 788 /// List of the meta annotations on the variable. | 788 /// List of the meta annotations on the variable. |
| 789 List<String> annotations; | 789 List<String> annotations; |
| 790 | 790 |
| 791 Variable(String name, this.isFinal, this.isStatic, this.isConst, this.type, | 791 Variable(String name, this.isFinal, this.isStatic, this.isConst, this.type, |
| 792 String comment, this.annotations, String qualifiedName, bool isPrivate, | 792 String comment, this.annotations, String qualifiedName, bool isPrivate, |
| 793 String owner) : super(name, comment, qualifiedName, isPrivate, owner); | 793 String owner) : super(name, comment, qualifiedName, isPrivate, owner); |
| 794 | 794 |
| 795 /// Generates a map describing the [Variable] object. | 795 /// Generates a map describing the [Variable] object. |
| 796 Map toMap() => { | 796 Map toMap() => { |
| 797 'name': name, | 797 'name': name, |
| 798 'qualifiedname': qualifiedName, | 798 'qualifiedName': qualifiedName, |
| 799 'comment': comment, | 799 'comment': comment, |
| 800 'final': isFinal.toString(), | 800 'final': isFinal.toString(), |
| 801 'static': isStatic.toString(), | 801 'static': isStatic.toString(), |
| 802 'constant': isConst.toString(), | 802 'constant': isConst.toString(), |
| 803 'type': new List.filled(1, type.toMap()), | 803 'type': new List.filled(1, type.toMap()), |
| 804 'annotations': annotations.map((a) => a.toMap()).toList() | 804 'annotations': annotations.map((a) => a.toMap()).toList() |
| 805 }; | 805 }; |
| 806 } | 806 } |
| 807 | 807 |
| 808 /** | 808 /** |
| (...skipping 27 matching lines...) Expand all Loading... |
| 836 if (comment.isNotEmpty) return; | 836 if (comment.isNotEmpty) return; |
| 837 entityMap[inheritedMethod.owner].ensureComments(); | 837 entityMap[inheritedMethod.owner].ensureComments(); |
| 838 comment = inheritedMethod.comment; | 838 comment = inheritedMethod.comment; |
| 839 commentInheritedFrom = inheritedMethod.commentInheritedFrom == '' ? | 839 commentInheritedFrom = inheritedMethod.commentInheritedFrom == '' ? |
| 840 inheritedMethod.qualifiedName : inheritedMethod.commentInheritedFrom; | 840 inheritedMethod.qualifiedName : inheritedMethod.commentInheritedFrom; |
| 841 } | 841 } |
| 842 | 842 |
| 843 /// Generates a map describing the [Method] object. | 843 /// Generates a map describing the [Method] object. |
| 844 Map toMap() => { | 844 Map toMap() => { |
| 845 'name': name, | 845 'name': name, |
| 846 'qualifiedname': qualifiedName, | 846 'qualifiedName': qualifiedName, |
| 847 'comment': comment, | 847 'comment': comment, |
| 848 'commentfrom': commentInheritedFrom, | 848 'commentFrom': commentInheritedFrom, |
| 849 'static': isStatic.toString(), | 849 'static': isStatic.toString(), |
| 850 'abstract': isAbstract.toString(), | 850 'abstract': isAbstract.toString(), |
| 851 'constant': isConst.toString(), | 851 'constant': isConst.toString(), |
| 852 'return': new List.filled(1, returnType.toMap()), | 852 'return': new List.filled(1, returnType.toMap()), |
| 853 'parameters': recurseMap(parameters), | 853 'parameters': recurseMap(parameters), |
| 854 'annotations': annotations.map((a) => a.toMap()).toList() | 854 'annotations': annotations.map((a) => a.toMap()).toList() |
| 855 }; | 855 }; |
| 856 } | 856 } |
| 857 | 857 |
| 858 /** | 858 /** |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1022 String qualifiedName; | 1022 String qualifiedName; |
| 1023 List<String> parameters; | 1023 List<String> parameters; |
| 1024 | 1024 |
| 1025 Annotation(this.qualifiedName, this.parameters); | 1025 Annotation(this.qualifiedName, this.parameters); |
| 1026 | 1026 |
| 1027 Map toMap() => { | 1027 Map toMap() => { |
| 1028 'name': qualifiedName, | 1028 'name': qualifiedName, |
| 1029 'parameters': parameters | 1029 'parameters': parameters |
| 1030 }; | 1030 }; |
| 1031 } | 1031 } |
| OLD | NEW |