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

Unified Diff: client/html/scripts/html_doc.dart

Issue 8947005: Refactor dartdoc into a class. Use method overriding to extend. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Respond to review. Created 9 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « client/html/scripts/html_diff.dart ('k') | utils/dartdoc/comment_map.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/html/scripts/html_doc.dart
diff --git a/client/html/scripts/html_doc.dart b/client/html/scripts/html_doc.dart
index ee7364d74edb5550ad4d88e9a7639eaf4c445769..784fb5013abf5b36f5cbf73718ff8741d8d72893 100644
--- a/client/html/scripts/html_doc.dart
+++ b/client/html/scripts/html_doc.dart
@@ -25,17 +25,33 @@ void main() {
var files = new NodeFileSystem();
parseOptions('../../frog', [] /* args */, files);
initializeWorld(files);
- doc.initializeDartDoc();
+ final htmldoc = new Htmldoc();
HtmlDiff.initialize();
_diff = new HtmlDiff();
_diff.run();
world.reset();
- doc.addMethodDocumenter(addMemberDoc);
- doc.addFieldDocumenter(addMemberDoc);
- doc.addTypeDocumenter(addTypeDoc);
- doc.document('html');
+ htmldoc.document('html');
+}
+
+class Htmldoc extends doc.Dartdoc {
+ getTypeComment(Type type) {
+ return _mergeComments(super.getTypeComment(type), getTypeDoc(type));
+ }
+
+ getMethodComment(MethodMember method) {
+ return _mergeComments(super.getMethodComment(method), getMemberDoc(method));
+ }
+
+ getFieldComment(FieldMember field) {
+ return _mergeComments(super.getFieldComment(field), getMemberDoc(field));
+ }
+
+ String _mergeComments(String comment, String extra) {
+ if (comment == null) return extra;
+ return '$comment\n\n$extra';
+ }
}
/**
@@ -81,7 +97,7 @@ Set<Member> _unifyProperties(Set<Member> members) {
* to the corresponding `dart:html` or `dart:dom` [Member](s). If [member] is
* not in `dart:html` or `dart:dom`, returns no additional documentation.
*/
-String addMemberDoc(Member member) {
+String getMemberDoc(Member member) {
if (_diff.domToHtml.containsKey(member)) {
final htmlMemberSet = _unifyProperties(_diff.domToHtml[member]);
final allSameName = htmlMemberSet.every((m) => _diff.sameName(member, m));
@@ -106,7 +122,7 @@ String addMemberDoc(Member member) {
* the corresponding `dart:html` or `dart:dom` [Type](s). If [type] is not in
* `dart:html` or `dart:dom`, returns no additional documentation.
*/
-String addTypeDoc(Type type) {
+String getTypeDoc(Type type) {
if (_diff.domTypesToHtml.containsKey(type)) {
var htmlTypes = doc.joinWithCommas(
map(_diff.domTypesToHtml[type], _linkType));
« no previous file with comments | « client/html/scripts/html_diff.dart ('k') | utils/dartdoc/comment_map.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698