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

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

Issue 141273003: Make constructor names hyphenated in qualifiedName json output. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 11 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 /// **docgen** is a tool for creating machine readable representations of Dart 5 /// **docgen** is a tool for creating machine readable representations of Dart
6 /// code metadata, including: classes, members, comments and annotations. 6 /// code metadata, including: classes, members, comments and annotations.
7 /// 7 ///
8 /// docgen is run on a `.dart` file or a directory containing `.dart` files. 8 /// docgen is run on a `.dart` file or a directory containing `.dart` files.
9 /// 9 ///
10 /// $ dart docgen.dart [OPTIONS] [FILE/DIR] 10 /// $ dart docgen.dart [OPTIONS] [FILE/DIR]
(...skipping 1755 matching lines...) Expand 10 before | Expand all | Expand 10 after
1766 1766
1767 String get docName { 1767 String get docName {
1768 if ((mirror as MethodMirror).isConstructor) { 1768 if ((mirror as MethodMirror).isConstructor) {
1769 // We name constructors specially -- including the class name again and a 1769 // We name constructors specially -- including the class name again and a
1770 // "-" to separate the constructor from its name (if any). 1770 // "-" to separate the constructor from its name (if any).
1771 return '${owner.docName}.${mirror.owner.simpleName}-${mirror.simpleName}'; 1771 return '${owner.docName}.${mirror.owner.simpleName}-${mirror.simpleName}';
1772 } 1772 }
1773 return super.docName; 1773 return super.docName;
1774 } 1774 }
1775 1775
1776 String get fileName => packagePrefix + docName;
Alan Knight 2014/01/16 22:50:24 This doesn't seem to be used.
1777
1776 /// Makes sure that the method with an inherited equivalent have comments. 1778 /// Makes sure that the method with an inherited equivalent have comments.
1777 void ensureCommentFor(Method inheritedMethod) { 1779 void ensureCommentFor(Method inheritedMethod) {
1778 if (comment.isNotEmpty) return; 1780 if (comment.isNotEmpty) return;
1779 1781
1780 comment = inheritedMethod._commentToHtml(this); 1782 comment = inheritedMethod._commentToHtml(this);
1781 _unresolvedComment = inheritedMethod._unresolvedComment; 1783 _unresolvedComment = inheritedMethod._unresolvedComment;
1782 commentInheritedFrom = inheritedMethod.commentInheritedFrom == '' ? 1784 commentInheritedFrom = inheritedMethod.commentInheritedFrom == '' ?
1783 new DummyMirror(inheritedMethod.mirror).docName : 1785 new DummyMirror(inheritedMethod.mirror).docName :
1784 inheritedMethod.commentInheritedFrom; 1786 inheritedMethod.commentInheritedFrom;
1785 } 1787 }
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1912 if (mirror is ClassMirror && !mirror.isTypedef) { 1914 if (mirror is ClassMirror && !mirror.isTypedef) {
1913 var innerList = []; 1915 var innerList = [];
1914 mirror.typeArguments.forEach((e) { 1916 mirror.typeArguments.forEach((e) {
1915 innerList.add(new Type(e, owningLibrary)); 1917 innerList.add(new Type(e, owningLibrary));
1916 }); 1918 });
1917 return innerList; 1919 return innerList;
1918 } 1920 }
1919 return []; 1921 return [];
1920 } 1922 }
1921 1923
1922 Map toMap() { 1924 Map toMap() => {
1923 // We may encounter types whose corresponding library has not been 1925 // We may encounter types whose corresponding library has not been
1924 // processed yet, so look up with the owningLibrary at the last moment. 1926 // processed yet, so look up with the owningLibrary at the last moment.
1925 var result = getDocgenObject(mirror, owningLibrary); 1927 'outer': getDocgenObject(mirror, owningLibrary).docName,
1926 return { 1928 'inner': _createTypeGenerics(mirror).map((e) => e.toMap()).toList(),
1927 'outer': result.docName, 1929 };
1928 'inner': _createTypeGenerics(mirror).map((e) => e.toMap()).toList(),
1929 };
1930 }
1931 } 1930 }
1932 1931
1933 /// Holds the name of the annotation, and its parameters. 1932 /// Holds the name of the annotation, and its parameters.
1934 class Annotation extends MirrorBased { 1933 class Annotation extends MirrorBased {
1935 List<String> parameters; 1934 List<String> parameters;
1936 /// The class of this annotation. 1935 /// The class of this annotation.
1937 ClassMirror mirror; 1936 ClassMirror mirror;
1938 Library owningLibrary; 1937 Library owningLibrary;
1939 1938
1940 Annotation(InstanceMirror originalMirror, this.owningLibrary) { 1939 Annotation(InstanceMirror originalMirror, this.owningLibrary) {
1941 mirror = originalMirror.type; 1940 mirror = originalMirror.type;
1942 parameters = originalMirror.type.variables.values 1941 parameters = originalMirror.type.variables.values
1943 .where((e) => e.isFinal) 1942 .where((e) => e.isFinal)
1944 .map((e) => originalMirror.getField(e.simpleName).reflectee) 1943 .map((e) => originalMirror.getField(e.simpleName).reflectee)
1945 .where((e) => e != null) 1944 .where((e) => e != null)
1946 .toList(); 1945 .toList();
1947 } 1946 }
1948 1947
1949 Map toMap() => { 1948 Map toMap() => {
1950 'name': getDocgenObject(mirror, owningLibrary).docName, 1949 'name': getDocgenObject(mirror, owningLibrary).docName,
1951 'parameters': parameters 1950 'parameters': parameters
1952 }; 1951 };
1953 } 1952 }
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