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

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

Issue 11341037: Rename InterfaceMirror to ClassMirror (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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/apidoc.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 to assist in documenting the difference between the dart:html API 6 * A script to assist in documenting the difference between the dart:html API
7 * and the old DOM API. 7 * and the old DOM API.
8 */ 8 */
9 #library('html_diff'); 9 #library('html_diff');
10 10
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 * places it in [htmlToDom] and [htmlTypesToDom]. Before this is run, dart2js 94 * places it in [htmlToDom] and [htmlTypesToDom]. Before this is run, dart2js
95 * should be initialized (via [parseOptions] and [initializeWorld]) and 95 * should be initialized (via [parseOptions] and [initializeWorld]) and
96 * [HtmlDiff.initialize] should be called. 96 * [HtmlDiff.initialize] should be called.
97 */ 97 */
98 void run() { 98 void run() {
99 LibraryMirror htmlLib = _mirrors.libraries[HTML_DECLARED_NAME]; 99 LibraryMirror htmlLib = _mirrors.libraries[HTML_DECLARED_NAME];
100 if (htmlLib === null) { 100 if (htmlLib === null) {
101 warn('Could not find $HTML_LIBRARY_NAME'); 101 warn('Could not find $HTML_LIBRARY_NAME');
102 return; 102 return;
103 } 103 }
104 for (InterfaceMirror htmlType in htmlLib.types.values) { 104 for (ClassMirror htmlType in htmlLib.types.values) {
105 final domTypes = htmlToDomTypes(htmlType); 105 final domTypes = htmlToDomTypes(htmlType);
106 if (domTypes.isEmpty) continue; 106 if (domTypes.isEmpty) continue;
107 107
108 htmlTypesToDom.putIfAbsent(htmlType.qualifiedName, 108 htmlTypesToDom.putIfAbsent(htmlType.qualifiedName,
109 () => new Set()).addAll(domTypes); 109 () => new Set()).addAll(domTypes);
110 110
111 htmlType.declaredMembers.forEach( 111 htmlType.declaredMembers.forEach(
112 (_, m) => _addMemberDiff(m, domTypes)); 112 (_, m) => _addMemberDiff(m, domTypes));
113 } 113 }
114 } 114 }
(...skipping 17 matching lines...) Expand all
132 if (!domMembers.isEmpty) { 132 if (!domMembers.isEmpty) {
133 htmlToDom[htmlMember.qualifiedName] = domMembers; 133 htmlToDom[htmlMember.qualifiedName] = domMembers;
134 } 134 }
135 } 135 }
136 136
137 /** 137 /**
138 * Returns the `@domName` type values that correspond to 138 * Returns the `@domName` type values that correspond to
139 * [htmlType] from `dart:html`. This can be the empty list if no 139 * [htmlType] from `dart:html`. This can be the empty list if no
140 * correspondence is found. 140 * correspondence is found.
141 */ 141 */
142 List<String> htmlToDomTypes(InterfaceMirror htmlType) { 142 List<String> htmlToDomTypes(ClassMirror htmlType) {
143 if (htmlType.simpleName == null) return []; 143 if (htmlType.simpleName == null) return [];
144 final tags = _getTags(comments.find(htmlType.location)); 144 final tags = _getTags(comments.find(htmlType.location));
145 if (tags.containsKey('domName')) { 145 if (tags.containsKey('domName')) {
146 var domNames = <String>[]; 146 var domNames = <String>[];
147 for (var s in tags['domName'].split(',')) { 147 for (var s in tags['domName'].split(',')) {
148 domNames.add(s.trim()); 148 domNames.add(s.trim());
149 } 149 }
150 if (domNames.length == 1 && domNames[0] == 'none') return <String>[]; 150 if (domNames.length == 1 && domNames[0] == 'none') return <String>[];
151 return domNames; 151 return domNames;
152 } 152 }
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 Map<String, String> _getTags(String comment) { 229 Map<String, String> _getTags(String comment) {
230 if (comment == null) return const <String, String>{}; 230 if (comment == null) return const <String, String>{};
231 final re = const RegExp("@([a-zA-Z]+) ([^;]+)(?:;|\$)"); 231 final re = const RegExp("@([a-zA-Z]+) ([^;]+)(?:;|\$)");
232 final tags = <String, String>{}; 232 final tags = <String, String>{};
233 for (var m in re.allMatches(comment.trim())) { 233 for (var m in re.allMatches(comment.trim())) {
234 tags[m[1]] = m[2]; 234 tags[m[1]] = m[2];
235 } 235 }
236 return tags; 236 return tags;
237 } 237 }
238 } 238 }
OLDNEW
« no previous file with comments | « utils/apidoc/apidoc.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698