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

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

Issue 14333011: Make source mirror ObjectMirror.getField synchronous (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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
« tools/dom/docs/lib/docs.dart ('K') | « tools/dom/docs/lib/docs.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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 * Returns the `@DomName` type values that correspond to 146 * Returns the `@DomName` type values that correspond to
147 * [htmlType] from `dart:html`. This can be the empty list if no 147 * [htmlType] from `dart:html`. This can be the empty list if no
148 * correspondence is found. 148 * correspondence is found.
149 */ 149 */
150 List<String> htmlToDomTypes(ClassMirror htmlType) { 150 List<String> htmlToDomTypes(ClassMirror htmlType) {
151 if (htmlType.simpleName == null) return <String>[]; 151 if (htmlType.simpleName == null) return <String>[];
152 152
153 final domNameMetadata = findMetadata(htmlType.metadata, 'DomName'); 153 final domNameMetadata = findMetadata(htmlType.metadata, 'DomName');
154 if (domNameMetadata != null) { 154 if (domNameMetadata != null) {
155 var domNames = <String>[]; 155 var domNames = <String>[];
156 var names = deprecatedFutureValue(domNameMetadata.getField('name')); 156 var names = domNameMetadata.getField('name');
157 for (var s in names.reflectee.split(',')) { 157 for (var s in names.reflectee.split(',')) {
158 domNames.add(s.trim()); 158 domNames.add(s.trim());
159 } 159 }
160 160
161 if (domNames.length == 1 && domNames[0] == 'none') return <String>[]; 161 if (domNames.length == 1 && domNames[0] == 'none') return <String>[];
162 return domNames; 162 return domNames;
163 } 163 }
164 return <String>[]; 164 return <String>[];
165 } 165 }
166 166
167 /** 167 /**
168 * Returns the `@DomName` member values that correspond to 168 * Returns the `@DomName` member values that correspond to
169 * [htmlMember] from `dart:html`. This can be the empty set if no 169 * [htmlMember] from `dart:html`. This can be the empty set if no
170 * correspondence is found. [domTypes] are the 170 * correspondence is found. [domTypes] are the
171 * `@DomName` type values that correspond to [htmlMember]'s 171 * `@DomName` type values that correspond to [htmlMember]'s
172 * defining type. 172 * defining type.
173 */ 173 */
174 Set<String> htmlToDomMembers(MemberMirror htmlMember, List<String> domTypes) { 174 Set<String> htmlToDomMembers(MemberMirror htmlMember, List<String> domTypes) {
175 if (htmlMember.isPrivate) return new Set(); 175 if (htmlMember.isPrivate) return new Set();
176 176
177 final domNameMetadata = findMetadata(htmlMember.metadata, 'DomName'); 177 final domNameMetadata = findMetadata(htmlMember.metadata, 'DomName');
178 if (domNameMetadata != null) { 178 if (domNameMetadata != null) {
179 var domNames = <String>[]; 179 var domNames = <String>[];
180 var names = deprecatedFutureValue(domNameMetadata.getField('name')); 180 var names = domNameMetadata.getField('name');
181 for (var s in names.reflectee.split(',')) { 181 for (var s in names.reflectee.split(',')) {
182 domNames.add(s.trim()); 182 domNames.add(s.trim());
183 } 183 }
184 184
185 if (domNames.length == 1 && domNames[0] == 'none') return new Set(); 185 if (domNames.length == 1 && domNames[0] == 'none') return new Set();
186 final members = new Set(); 186 final members = new Set();
187 domNames.forEach((name) { 187 domNames.forEach((name) {
188 var nameMembers = _membersFromName(name, domTypes); 188 var nameMembers = _membersFromName(name, domTypes);
189 if (nameMembers.isEmpty) { 189 if (nameMembers.isEmpty) {
190 if (name.contains('.')) { 190 if (name.contains('.')) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 return members; 225 return members;
226 } 226 }
227 227
228 if (name.split('.').length != 2) { 228 if (name.split('.').length != 2) {
229 warn('invalid member name ${name}'); 229 warn('invalid member name ${name}');
230 return new Set(); 230 return new Set();
231 } 231 }
232 return new Set.from([name]); 232 return new Set.from([name]);
233 } 233 }
234 } 234 }
OLDNEW
« tools/dom/docs/lib/docs.dart ('K') | « tools/dom/docs/lib/docs.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698