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

Side by Side Diff: pkg/docgen/lib/docgen.dart

Issue 22962007: Checks if a mirror is a typedef mirror first. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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 | « no previous file | 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) 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 723 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 * A container to categorize classes into the following groups: abstract 734 * A container to categorize classes into the following groups: abstract
735 * classes, regular classes, typedefs, and errors. 735 * classes, regular classes, typedefs, and errors.
736 */ 736 */
737 class ClassGroup { 737 class ClassGroup {
738 Map<String, Class> classes = {}; 738 Map<String, Class> classes = {};
739 Map<String, Typedef> typedefs = {}; 739 Map<String, Typedef> typedefs = {};
740 Map<String, Class> errors = {}; 740 Map<String, Class> errors = {};
741 741
742 void addClass(ClassMirror mirror) { 742 void addClass(ClassMirror mirror) {
743 _currentClass = mirror; 743 _currentClass = mirror;
744 var clazz = _class(mirror); 744 if (mirror.isTypedef) {
745
746 // Adding inherited parent variables and methods.
747 clazz.parent().forEach((parent) {
748 if (_isVisible(clazz)) {
749 parent.addSubclass(clazz);
750 }
751 });
752
753 clazz.ensureComments();
754
755 if (clazz.isError()) {
756 errors[mirror.simpleName] = clazz;
757 } else if (mirror.isTypedef) {
758 if (_includePrivate || !mirror.isPrivate) { 745 if (_includePrivate || !mirror.isPrivate) {
759 entityMap[mirror.qualifiedName] = new Typedef(mirror.simpleName, 746 entityMap[mirror.qualifiedName] = new Typedef(mirror.simpleName,
760 mirror.value.returnType.qualifiedName, _commentToHtml(mirror), 747 mirror.value.returnType.qualifiedName, _commentToHtml(mirror),
761 _generics(mirror), _parameters(mirror.value.parameters), 748 _generics(mirror), _parameters(mirror.value.parameters),
762 _annotations(mirror), mirror.qualifiedName, _isHidden(mirror), 749 _annotations(mirror), mirror.qualifiedName, _isHidden(mirror),
763 mirror.owner.qualifiedName); 750 mirror.owner.qualifiedName);
764 typedefs[mirror.simpleName] = entityMap[mirror.qualifiedName]; 751 typedefs[mirror.simpleName] = entityMap[mirror.qualifiedName];
765 } 752 }
766 } else if (mirror.isClass) {
767 classes[mirror.simpleName] = clazz;
768 } else { 753 } else {
769 throw new ArgumentError('${mirror.simpleName} - no class type match. '); 754 var clazz = _class(mirror);
755
756 // Adding inherited parent variables and methods.
757 clazz.parent().forEach((parent) {
758 if (_isVisible(clazz)) {
759 parent.addSubclass(clazz);
760 }
761 });
762
763 clazz.ensureComments();
764
765 if (clazz.isError()) {
766 errors[mirror.simpleName] = clazz;
767 } else if (mirror.isClass) {
768 classes[mirror.simpleName] = clazz;
769 } else {
770 throw new ArgumentError('${mirror.simpleName} - no class type match. ');
771 }
770 } 772 }
771 } 773 }
772 774
773 /** 775 /**
774 * Checks if the given name is a key for any of the Class Maps. 776 * Checks if the given name is a key for any of the Class Maps.
775 */ 777 */
776 bool containsKey(String name) { 778 bool containsKey(String name) {
777 return classes.containsKey(name) || errors.containsKey(name); 779 return classes.containsKey(name) || errors.containsKey(name);
778 } 780 }
779 781
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
1074 String qualifiedName; 1076 String qualifiedName;
1075 List<String> parameters; 1077 List<String> parameters;
1076 1078
1077 Annotation(this.qualifiedName, this.parameters); 1079 Annotation(this.qualifiedName, this.parameters);
1078 1080
1079 Map toMap() => { 1081 Map toMap() => {
1080 'name': qualifiedName, 1082 'name': qualifiedName,
1081 'parameters': parameters 1083 'parameters': parameters
1082 }; 1084 };
1083 } 1085 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698