| OLD | NEW |
| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 } | 85 } |
| 86 } | 86 } |
| 87 | 87 |
| 88 /** | 88 /** |
| 89 * Computes the `@domName` to `dart:html` mapping, and | 89 * Computes the `@domName` to `dart:html` mapping, and |
| 90 * places it in [htmlToDom] and [htmlTypesToDom]. Before this is run, dart2js | 90 * places it in [htmlToDom] and [htmlTypesToDom]. Before this is run, dart2js |
| 91 * should be initialized (via [parseOptions] and [initializeWorld]) and | 91 * should be initialized (via [parseOptions] and [initializeWorld]) and |
| 92 * [HtmlDiff.initialize] should be called. | 92 * [HtmlDiff.initialize] should be called. |
| 93 */ | 93 */ |
| 94 void run() { | 94 void run() { |
| 95 LibraryMirror htmlLib = findMirror(_mirrors.libraries, HTML_LIBRARY_NAME); | 95 LibraryMirror htmlLib = _mirrors.libraries[HTML_LIBRARY_NAME]; |
| 96 if (htmlLib === null) { | 96 if (htmlLib === null) { |
| 97 warn('Could not find $HTML_LIBRARY_NAME'); | 97 warn('Could not find $HTML_LIBRARY_NAME'); |
| 98 return; | 98 return; |
| 99 } | 99 } |
| 100 for (InterfaceMirror htmlType in htmlLib.types.getValues()) { | 100 for (InterfaceMirror htmlType in htmlLib.types.getValues()) { |
| 101 final domTypes = htmlToDomTypes(htmlType); | 101 final domTypes = htmlToDomTypes(htmlType); |
| 102 if (domTypes.isEmpty()) continue; | 102 if (domTypes.isEmpty()) continue; |
| 103 | 103 |
| 104 htmlTypesToDom.putIfAbsent(htmlType.qualifiedName, | 104 htmlTypesToDom.putIfAbsent(htmlType.qualifiedName, |
| 105 () => new Set()).addAll(domTypes); | 105 () => new Set()).addAll(domTypes); |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 Map<String, String> _getTags(String comment) { | 225 Map<String, String> _getTags(String comment) { |
| 226 if (comment == null) return const <String, String>{}; | 226 if (comment == null) return const <String, String>{}; |
| 227 final re = const RegExp("@([a-zA-Z]+) ([^;]+)(?:;|\$)"); | 227 final re = const RegExp("@([a-zA-Z]+) ([^;]+)(?:;|\$)"); |
| 228 final tags = <String, String>{}; | 228 final tags = <String, String>{}; |
| 229 for (var m in re.allMatches(comment.trim())) { | 229 for (var m in re.allMatches(comment.trim())) { |
| 230 tags[m[1]] = m[2]; | 230 tags[m[1]] = m[2]; |
| 231 } | 231 } |
| 232 return tags; | 232 return tags; |
| 233 } | 233 } |
| 234 } | 234 } |
| OLD | NEW |