| 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 for printing a JSON dump of HTML diff data. In particular, this | 6 * A script for printing a JSON dump of HTML diff data. In particular, this |
| 7 * lists a map of `dart:dom` methods that have been renamed to `dart:html` | 7 * lists a map of `dart:dom` methods that have been renamed to `dart:html` |
| 8 * methods without changing their semantics, and `dart:dom` methods that have | 8 * methods without changing their semantics, and `dart:dom` methods that have |
| 9 * been removed in `dart:html`. As a heuristic, a `dart:html` method doesn't | 9 * been removed in `dart:html`. As a heuristic, a `dart:html` method doesn't |
| 10 * change the semantics of the corresponding `dart:dom` method if it's the only | 10 * change the semantics of the corresponding `dart:dom` method if it's the only |
| 11 * corresponding HTML method and it has the corresponding return type. | 11 * corresponding HTML method and it has the corresponding return type. |
| 12 * | 12 * |
| 13 * The format of the output is as follows: | 13 * The format of the output is as follows: |
| 14 * | 14 * |
| 15 * { | 15 * { |
| 16 * "renamed": { domName: htmlName, ... }, | 16 * "renamed": { domName: htmlName, ... }, |
| 17 * "removed": [name, ...] | 17 * "removed": [name, ...] |
| 18 * } | 18 * } |
| 19 * | 19 * |
| 20 * Note that the removed members are listed with the names they would have in | 20 * Note that the removed members are listed with the names they would have in |
| 21 * HTML where possible; e.g. `HTMLMediaElement.get:textTracks` is listed as | 21 * HTML where possible; e.g. `HTMLMediaElement.get:textTracks` is listed as |
| 22 * `MediaElement.get:textTracks`. | 22 * `MediaElement.get:textTracks`. |
| 23 */ | 23 */ |
| 24 #library('html_diff_dump'); | 24 #library('html_diff_dump'); |
| 25 | 25 |
| 26 #import('dart:json'); | 26 #import('dart:json'); |
| 27 #import('html_diff.dart'); | 27 #import('html_diff.dart'); |
| 28 #import('../../frog/lang.dart'); | 28 #import('../../frog/lang.dart'); |
| 29 #import('../../frog/file_system_node.dart'); | |
| 30 | 29 |
| 31 HtmlDiff diff; | 30 HtmlDiff diff; |
| 32 | 31 |
| 33 /** Whether or not a domType represents the same type as an htmlType. */ | 32 /** Whether or not a domType represents the same type as an htmlType. */ |
| 34 bool sameType(Type domType, Type htmlType) { | 33 bool sameType(Type domType, Type htmlType) { |
| 35 if (domType.isVoid || htmlType.isVoid) { | 34 if (domType.isVoid || htmlType.isVoid) { |
| 36 return domType.isVoid && htmlType.isVoid; | 35 return domType.isVoid && htmlType.isVoid; |
| 37 } | 36 } |
| 38 | 37 |
| 39 final htmlTypes = diff.domTypesToHtml[domType]; | 38 final htmlTypes = diff.domTypesToHtml[domType]; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 if (member.canSet && !htmlMembers.some((m) => m.name.startsWith('set:'
))) { | 127 if (member.canSet && !htmlMembers.some((m) => m.name.startsWith('set:'
))) { |
| 129 removed.add(htmlishMemberDesc(member.setter)); | 128 removed.add(htmlishMemberDesc(member.setter)); |
| 130 } | 129 } |
| 131 } | 130 } |
| 132 } | 131 } |
| 133 } | 132 } |
| 134 } | 133 } |
| 135 | 134 |
| 136 print(JSON.stringify({'renamed': renamed, 'removed': removed})); | 135 print(JSON.stringify({'renamed': renamed, 'removed': removed})); |
| 137 } | 136 } |
| OLD | NEW |