| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 * `dart:htmlimpl`, or `null` if there is no such correspondence. | 157 * `dart:htmlimpl`, or `null` if there is no such correspondence. |
| 158 */ | 158 */ |
| 159 Member htmlImplToHtmlMember(Member implMember) { | 159 Member htmlImplToHtmlMember(Member implMember) { |
| 160 var htmlType = htmlImplToHtmlType(implMember.declaringType); | 160 var htmlType = htmlImplToHtmlType(implMember.declaringType); |
| 161 if (htmlType == null) return null; | 161 if (htmlType == null) return null; |
| 162 | 162 |
| 163 bool getter, setter; | 163 bool getter, setter; |
| 164 if (implMember.isConstructor || implMember.isFactory) { | 164 if (implMember.isConstructor || implMember.isFactory) { |
| 165 var constructor = htmlType.constructors[implMember.name]; | 165 var constructor = htmlType.constructors[implMember.name]; |
| 166 if (constructor != null) return constructor; | 166 if (constructor != null) return constructor; |
| 167 return htmlType.factories[implMember.name]; | 167 |
| 168 // Look for a factory constructor whose type and name matches the member. |
| 169 return htmlType.factories.getFactoriesFor(implMember.name)[ |
| 170 implMember.constructorName]; |
| 168 } else if ((getter = implMember.name.startsWith('get:')) || | 171 } else if ((getter = implMember.name.startsWith('get:')) || |
| 169 (setter = implMember.name.startsWith('set:'))) { | 172 (setter = implMember.name.startsWith('set:'))) { |
| 170 // Use getMember to follow interface inheritance chains. | 173 // Use getMember to follow interface inheritance chains. |
| 171 var htmlProperty = htmlType.getMember(implMember.name.substring(4)); | 174 var htmlProperty = htmlType.getMember(implMember.name.substring(4)); |
| 172 if (htmlProperty != null) { | 175 if (htmlProperty != null) { |
| 173 return getter ? htmlProperty.getter : htmlProperty.setter; | 176 return getter ? htmlProperty.getter : htmlProperty.setter; |
| 174 } else { | 177 } else { |
| 175 return null; | 178 return null; |
| 176 } | 179 } |
| 177 } else { | 180 } else { |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 Map<String, String> _getTags(String comment) { | 394 Map<String, String> _getTags(String comment) { |
| 392 if (comment == null) return const <String>{}; | 395 if (comment == null) return const <String>{}; |
| 393 final re = new RegExp("@([a-zA-Z]+) ([^;]+)(?:;|\$)"); | 396 final re = new RegExp("@([a-zA-Z]+) ([^;]+)(?:;|\$)"); |
| 394 final tags = <String>{}; | 397 final tags = <String>{}; |
| 395 for (var m in re.allMatches(comment.trim())) { | 398 for (var m in re.allMatches(comment.trim())) { |
| 396 tags[m[1]] = m[2]; | 399 tags[m[1]] = m[2]; |
| 397 } | 400 } |
| 398 return tags; | 401 return tags; |
| 399 } | 402 } |
| 400 } | 403 } |
| OLD | NEW |