| 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 |
| 11 #import('dart:coreimpl'); | 11 #import('dart:coreimpl'); |
| 12 #import('dart:io'); |
| 12 | 13 |
| 13 #import('../../lib/dartdoc/dartdoc.dart'); | 14 #import('../../lib/dartdoc/dartdoc.dart'); |
| 14 #import('../../lib/dartdoc/mirrors/mirrors.dart'); | 15 #import('../../lib/dartdoc/mirrors/mirrors.dart'); |
| 15 #import('../../lib/dartdoc/mirrors/mirrors_util.dart'); | 16 #import('../../lib/dartdoc/mirrors/mirrors_util.dart'); |
| 16 | 17 |
| 17 /** | 18 /** |
| 18 * A class for computing a many-to-many mapping between the types and | 19 * A class for computing a many-to-many mapping between the types and |
| 19 * members in `dart:dom_deprecated` and `dart:html`. This mapping is | 20 * members in `dart:dom_deprecated` and `dart:html`. This mapping is |
| 20 * based on two indicators: | 21 * based on two indicators: |
| 21 * | 22 * |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 final bool _printWarnings; | 70 final bool _printWarnings; |
| 70 | 71 |
| 71 static Compilation _compilation; | 72 static Compilation _compilation; |
| 72 static MirrorSystem _mirrors; | 73 static MirrorSystem _mirrors; |
| 73 static LibraryMirror dom; | 74 static LibraryMirror dom; |
| 74 | 75 |
| 75 /** | 76 /** |
| 76 * Perform static initialization of [world]. This should be run before | 77 * Perform static initialization of [world]. This should be run before |
| 77 * calling [HtmlDiff.run]. | 78 * calling [HtmlDiff.run]. |
| 78 */ | 79 */ |
| 79 static void initialize(String libDir) { | 80 static void initialize(Path libDir) { |
| 80 _compilation = new Compilation.library( | 81 _compilation = new Compilation.library( |
| 81 const <String>['dart:dom_deprecated', 'dart:html'], libDir); | 82 const <Path>[ |
| 83 const Path('dart:dom_deprecated'), |
| 84 const Path('dart:html') |
| 85 ], libDir); |
| 82 _mirrors = _compilation.mirrors(); | 86 _mirrors = _compilation.mirrors(); |
| 83 | 87 |
| 84 // Find 'dart:dom_deprecated' by its library tag 'dom'. | 88 // Find 'dart:dom_deprecated' by its library tag 'dom'. |
| 85 dom = findMirror(_mirrors.libraries(), 'dom'); | 89 dom = findMirror(_mirrors.libraries(), 'dom'); |
| 86 } | 90 } |
| 87 | 91 |
| 88 HtmlDiff([bool printWarnings = false]) : | 92 HtmlDiff([bool printWarnings = false]) : |
| 89 _printWarnings = printWarnings, | 93 _printWarnings = printWarnings, |
| 90 domToHtml = new Map<MemberMirror, Set<MemberMirror>>(), | 94 domToHtml = new Map<MemberMirror, Set<MemberMirror>>(), |
| 91 htmlToDom = new Map<MemberMirror, Set<MemberMirror>>(), | 95 htmlToDom = new Map<MemberMirror, Set<MemberMirror>>(), |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 Map<String, String> _getTags(String comment) { | 272 Map<String, String> _getTags(String comment) { |
| 269 if (comment == null) return const <String>{}; | 273 if (comment == null) return const <String>{}; |
| 270 final re = const RegExp("@([a-zA-Z]+) ([^;]+)(?:;|\$)"); | 274 final re = const RegExp("@([a-zA-Z]+) ([^;]+)(?:;|\$)"); |
| 271 final tags = <String>{}; | 275 final tags = <String>{}; |
| 272 for (var m in re.allMatches(comment.trim())) { | 276 for (var m in re.allMatches(comment.trim())) { |
| 273 tags[m[1]] = m[2]; | 277 tags[m[1]] = m[2]; |
| 274 } | 278 } |
| 275 return tags; | 279 return tags; |
| 276 } | 280 } |
| 277 } | 281 } |
| OLD | NEW |