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

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

Issue 20617005: Returning the closest public superclass rather than returning "" (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 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 this.isPrivate = true; 613 this.isPrivate = true;
614 // Since we are now making the mixin a private class, make all elements 614 // Since we are now making the mixin a private class, make all elements
615 // with the mixin as an owner private too. 615 // with the mixin as an owner private too.
616 entityMap.values.where((e) => e.owner == qualifiedName) 616 entityMap.values.where((e) => e.owner == qualifiedName)
617 .forEach((element) => element.isPrivate = true); 617 .forEach((element) => element.isPrivate = true);
618 // Move the subclass up to the next public superclass 618 // Move the subclass up to the next public superclass
619 subclasses.forEach((subclass) => addSubclass(entityMap[subclass])); 619 subclasses.forEach((subclass) => addSubclass(entityMap[subclass]));
620 } 620 }
621 } 621 }
622 622
623 /**
624 * If a class extends a private superclass, find the closest public superclass
625 * of the private superclass.
626 */
627 String validSuperclass() {
628 if (superclass == null) return "";
Bob Nystrom 2013/08/01 23:31:40 Is there a reason to return "" instead of "Object"
janicejl 2013/08/02 00:49:09 Done.
629 else {
Bob Nystrom 2013/08/01 23:31:40 "else" isn't needed here.
janicejl 2013/08/02 00:49:09 Done.
630 if (_filterPrivate(superclass)) return superclass.qualifiedName;
Bob Nystrom 2013/08/01 23:31:40 "filter" is a bit confusing here. I would expect i
janicejl 2013/08/02 00:49:09 Done.
631 else return superclass.validSuperclass();
Bob Nystrom 2013/08/01 23:31:40 "else" isn't needed here.
janicejl 2013/08/02 00:49:09 Done.
632 }
633 }
634
623 /// Generates a map describing the [Class] object. 635 /// Generates a map describing the [Class] object.
624 Map toMap() => { 636 Map toMap() => {
625 'name': name, 637 'name': name,
626 'qualifiedname': qualifiedName, 638 'qualifiedname': qualifiedName,
627 'comment': comment, 639 'comment': comment,
628 'superclass': superclass == null ? "" : (_filterPrivate(superclass)) ? 640 'superclass': validSuperclass(),
629 superclass.qualifiedName : "",
630 'implements': new List.from(interfaces.where((e) => _filterPrivate(e)) 641 'implements': new List.from(interfaces.where((e) => _filterPrivate(e))
631 .map((e) => e.qualifiedName)), 642 .map((e) => e.qualifiedName)),
632 'subclass': new List.from(subclasses), 643 'subclass': new List.from(subclasses),
633 'variables': recurseMap(variables), 644 'variables': recurseMap(variables),
634 'inheritedvariables': recurseMap(inheritedVariables), 645 'inheritedvariables': recurseMap(inheritedVariables),
635 'methods': methods.toMap(), 646 'methods': methods.toMap(),
636 'inheritedmethods': inheritedMethods.toMap(), 647 'inheritedmethods': inheritedMethods.toMap(),
637 'annotations': new List.from(annotations), 648 'annotations': new List.from(annotations),
638 'generics': recurseMap(generics) 649 'generics': recurseMap(generics)
639 }; 650 };
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 String outer; 939 String outer;
929 List<Type> inner; 940 List<Type> inner;
930 941
931 Type(this.outer, this.inner); 942 Type(this.outer, this.inner);
932 943
933 Map toMap() => { 944 Map toMap() => {
934 'outer': outer, 945 'outer': outer,
935 'inner': new List.from(inner.map((e) => e.toMap())) 946 'inner': new List.from(inner.map((e) => e.toMap()))
936 }; 947 };
937 } 948 }
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