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

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

Issue 10823257: Refactored accessors in mirrors from methods to properties. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Missing updates Created 8 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 | « 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
(...skipping 18 matching lines...) Expand all
29 #import('dart:io'); 29 #import('dart:io');
30 #import('html_diff.dart'); 30 #import('html_diff.dart');
31 #import('../../lib/dartdoc/mirrors/mirrors.dart'); 31 #import('../../lib/dartdoc/mirrors/mirrors.dart');
32 #import('../../lib/dartdoc/mirrors/mirrors_util.dart'); 32 #import('../../lib/dartdoc/mirrors/mirrors_util.dart');
33 33
34 HtmlDiff diff; 34 HtmlDiff diff;
35 35
36 /** 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. */
37 bool sameType(MemberMirror domMember, MemberMirror htmlMember) { 37 bool sameType(MemberMirror domMember, MemberMirror htmlMember) {
38 TypeMirror domType = domMember is FieldMirror 38 TypeMirror domType = domMember is FieldMirror
39 ? domMember.type() 39 ? domMember.type
40 : domMember.returnType(); 40 : domMember.returnType;
41 TypeMirror htmlType = htmlMember is FieldMirror 41 TypeMirror htmlType = htmlMember is FieldMirror
42 ? htmlMember.type() 42 ? htmlMember.type
43 : htmlMember.returnType(); 43 : htmlMember.returnType;
44 if (domType.isVoid || htmlType.isVoid) { 44 if (domType.isVoid || htmlType.isVoid) {
45 return domType.isVoid && htmlType.isVoid; 45 return domType.isVoid && htmlType.isVoid;
46 } 46 }
47 47
48 final htmlTypes = diff.domTypesToHtml[domType.qualifiedName()]; 48 final htmlTypes = diff.domTypesToHtml[domType.qualifiedName];
49 return htmlTypes != null && htmlTypes.some((t) => t == htmlType); 49 return htmlTypes != null && htmlTypes.some((t) => t == htmlType);
50 } 50 }
51 51
52 /** Returns the name of a member, including `get:` if it's a field. */ 52 /** Returns the name of a member, including `get:` if it's a field. */
53 String memberName(MemberMirror m) => m.simpleName(); 53 String memberName(MemberMirror m) => m.simpleName;
54 54
55 /** 55 /**
56 * Returns a string describing the name of a member. If [type] is passed, it's 56 * Returns a string describing the name of a member. If [type] is passed, it's
57 * used in place of the member's real type name. 57 * used in place of the member's real type name.
58 */ 58 */
59 String memberDesc(MemberMirror m, [ObjectMirror type = null]) { 59 String memberDesc(MemberMirror m, [ObjectMirror type = null]) {
60 if (type == null) type = m.surroundingDeclaration(); 60 if (type == null) type = m.surroundingDeclaration;
61 return '${type.simpleName()}.${memberName(m)}'; 61 return '${type.simpleName}.${memberName(m)}';
62 } 62 }
63 63
64 /** 64 /**
65 * Same as [memberDesc], but if [m] is a `dart:dom_deprecated` type 65 * Same as [memberDesc], but if [m] is a `dart:dom_deprecated` type
66 * its `dart:html` typename is used instead. 66 * its `dart:html` typename is used instead.
67 */ 67 */
68 String htmlishMemberDesc(MemberMirror m) { 68 String htmlishMemberDesc(MemberMirror m) {
69 var type = m.surroundingDeclaration(); 69 var type = m.surroundingDeclaration;
70 final htmlTypes = diff.domTypesToHtml[type.qualifiedName()]; 70 final htmlTypes = diff.domTypesToHtml[type.qualifiedName];
71 if (htmlTypes != null && htmlTypes.length == 1) { 71 if (htmlTypes != null && htmlTypes.length == 1) {
72 type = htmlTypes.iterator().next(); 72 type = htmlTypes.iterator().next();
73 } 73 }
74 return memberDesc(m, type); 74 return memberDesc(m, type);
75 } 75 }
76 76
77 /** 77 /**
78 * Add an entry to the map of `dart:dom_deprecated` names to 78 * Add an entry to the map of `dart:dom_deprecated` names to
79 * `dart:html` names if [domMember] was renamed to [htmlMembers] with 79 * `dart:html` names if [domMember] was renamed to [htmlMembers] with
80 * the same semantics. 80 * the same semantics.
(...skipping 16 matching lines...) Expand all
97 diff.run(); 97 diff.run();
98 98
99 final renamed = <String>{}; 99 final renamed = <String>{};
100 diff.domToHtml.forEach((MemberMirror domMember, 100 diff.domToHtml.forEach((MemberMirror domMember,
101 Set<MemberMirror> htmlMembers) { 101 Set<MemberMirror> htmlMembers) {
102 maybeAddRename(renamed, domMember, htmlMembers); 102 maybeAddRename(renamed, domMember, htmlMembers);
103 }); 103 });
104 104
105 final removed = <String>[]; 105 final removed = <String>[];
106 106
107 for (InterfaceMirror type in HtmlDiff.dom.types().getValues()) { 107 for (InterfaceMirror type in HtmlDiff.dom.types.getValues()) {
108 if (type.declaredMembers().getValues().every((m) => 108 if (type.declaredMembers.getValues().every((m) =>
109 !diff.domToHtml.containsKey(m))) { 109 !diff.domToHtml.containsKey(m))) {
110 removed.add('${type.simpleName()}.*'); 110 removed.add('${type.simpleName}.*');
111 } else { 111 } else {
112 for (MemberMirror member in type.declaredMembers().getValues()) { 112 for (MemberMirror member in type.declaredMembers.getValues()) {
113 if (!diff.domToHtml.containsKey(member)) { 113 if (!diff.domToHtml.containsKey(member)) {
114 removed.add(htmlishMemberDesc(member)); 114 removed.add(htmlishMemberDesc(member));
115 } 115 }
116 } 116 }
117 } 117 }
118 } 118 }
119 119
120 print(JSON.stringify({'renamed': renamed, 'removed': removed})); 120 print(JSON.stringify({'renamed': renamed, 'removed': removed}));
121 } 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