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

Side by Side Diff: utils/apidoc/html_diff_dump.dart

Issue 10780030: Dartdoc and apidoc updated to use Path. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments Created 8 years, 5 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 | « utils/apidoc/html_diff.dart ('k') | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 * A script for printing a JSON dump of HTML diff data. In particular, 6 * A script for printing a JSON dump of HTML diff data. In particular,
7 * this lists a map of `dart:dom_deprecated` methods that have been 7 * this lists a map of `dart:dom_deprecated` methods that have been
8 * renamed to `dart:html` methods without changing their semantics, 8 * renamed to `dart:html` methods without changing their semantics,
9 * and `dart:dom_deprecated` methods that have been removed in 9 * and `dart:dom_deprecated` methods that have been removed in
10 * `dart:html`. As a heuristic, a `dart:html` method doesn't change 10 * `dart:html`. As a heuristic, a `dart:html` method doesn't change
11 * the semantics of the corresponding `dart:dom_deprecated` method if 11 * the semantics of the corresponding `dart:dom_deprecated` method if
12 * it's the only corresponding HTML method and it has the 12 * it's the only corresponding HTML method and it has the
13 * corresponding return type. 13 * corresponding return type.
14 * 14 *
15 * The format of the output is as follows: 15 * The format of the output is as follows:
16 * 16 *
17 * { 17 * {
18 * "renamed": { domName: htmlName, ... }, 18 * "renamed": { domName: htmlName, ... },
19 * "removed": [name, ...] 19 * "removed": [name, ...]
20 * } 20 * }
21 * 21 *
22 * Note that the removed members are listed with the names they would have in 22 * Note that the removed members are listed with the names they would have in
23 * HTML where possible; e.g. `HTMLMediaElement.get:textTracks` is listed as 23 * HTML where possible; e.g. `HTMLMediaElement.get:textTracks` is listed as
24 * `MediaElement.get:textTracks`. 24 * `MediaElement.get:textTracks`.
25 */ 25 */
26 #library('html_diff_dump'); 26 #library('html_diff_dump');
27 27
28 #import('dart:json'); 28 #import('dart:json');
29 #import('dart:io');
29 #import('html_diff.dart'); 30 #import('html_diff.dart');
30 #import('../../lib/dartdoc/mirrors/mirrors.dart'); 31 #import('../../lib/dartdoc/mirrors/mirrors.dart');
31 #import('../../lib/dartdoc/mirrors/mirrors_util.dart'); 32 #import('../../lib/dartdoc/mirrors/mirrors_util.dart');
32 33
33 HtmlDiff diff; 34 HtmlDiff diff;
34 35
35 /** Whether or not a domType represents the same type as an htmlType. */ 36 /** Whether or not a domType represents the same type as an htmlType. */
36 bool sameType(MemberMirror domMember, MemberMirror htmlMember) { 37 bool sameType(MemberMirror domMember, MemberMirror htmlMember) {
37 TypeMirror domType = domMember is FieldMirror 38 TypeMirror domType = domMember is FieldMirror
38 ? domMember.type() 39 ? domMember.type()
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 Collection<MemberMirror> htmlMembers) { 84 Collection<MemberMirror> htmlMembers) {
84 if (htmlMembers.length != 1) return; 85 if (htmlMembers.length != 1) return;
85 final htmlMember = htmlMembers.iterator().next(); 86 final htmlMember = htmlMembers.iterator().next();
86 if (memberName(domMember) != memberName(htmlMember) && 87 if (memberName(domMember) != memberName(htmlMember) &&
87 sameType(domMember, htmlMember)) { 88 sameType(domMember, htmlMember)) {
88 renamed[memberDesc(domMember)] = memberDesc(htmlMember); 89 renamed[memberDesc(domMember)] = memberDesc(htmlMember);
89 } 90 }
90 } 91 }
91 92
92 void main() { 93 void main() {
93 var libPath = '../../'; 94 var libPath = const Path('../../');
94 HtmlDiff.initialize(libPath); 95 HtmlDiff.initialize(libPath);
95 diff = new HtmlDiff(); 96 diff = new HtmlDiff();
96 diff.run(); 97 diff.run();
97 98
98 final renamed = <String>{}; 99 final renamed = <String>{};
99 diff.domToHtml.forEach((MemberMirror domMember, 100 diff.domToHtml.forEach((MemberMirror domMember,
100 Set<MemberMirror> htmlMembers) { 101 Set<MemberMirror> htmlMembers) {
101 maybeAddRename(renamed, domMember, htmlMembers); 102 maybeAddRename(renamed, domMember, htmlMembers);
102 }); 103 });
103 104
104 final removed = <String>[]; 105 final removed = <String>[];
105 106
106 for (InterfaceMirror type in HtmlDiff.dom.types().getValues()) { 107 for (InterfaceMirror type in HtmlDiff.dom.types().getValues()) {
107 if (type.declaredMembers().getValues().every((m) => 108 if (type.declaredMembers().getValues().every((m) =>
108 !diff.domToHtml.containsKey(m))) { 109 !diff.domToHtml.containsKey(m))) {
109 removed.add('${type.simpleName()}.*'); 110 removed.add('${type.simpleName()}.*');
110 } else { 111 } else {
111 for (MemberMirror member in type.declaredMembers().getValues()) { 112 for (MemberMirror member in type.declaredMembers().getValues()) {
112 if (!diff.domToHtml.containsKey(member)) { 113 if (!diff.domToHtml.containsKey(member)) {
113 removed.add(htmlishMemberDesc(member)); 114 removed.add(htmlishMemberDesc(member));
114 } 115 }
115 } 116 }
116 } 117 }
117 } 118 }
118 119
119 print(JSON.stringify({'renamed': renamed, 'removed': removed})); 120 print(JSON.stringify({'renamed': renamed, 'removed': removed}));
120 } 121 }
OLDNEW
« no previous file with comments | « utils/apidoc/html_diff.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698