| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 // Note: This test relies on LF line endings in the source file. | 5 // Note: This test relies on LF line endings in the source file. |
| 6 | 6 |
| 7 // Test that JS printer callbacks occur when expected. | 7 // Test that JS printer callbacks occur when expected. |
| 8 | 8 |
| 9 library js_ast.printer.callback_test; | 9 library js_ast.printer.callback_test; |
| 10 | 10 |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 [1,, 2]; | 154 [1,, 2]; |
| 155 @0}""", | 155 @0}""", |
| 156 TestMode.EXIT: """ | 156 TestMode.EXIT: """ |
| 157 function() { | 157 function() { |
| 158 a@4.b@5@3; | 158 a@4.b@5@3; |
| 159 @2 [1@8,,@9 2@10]@7; | 159 @2 [1@8,,@9 2@10]@7; |
| 160 @6}@1@0""", | 160 @6}@1@0""", |
| 161 }), | 161 }), |
| 162 | 162 |
| 163 const TestCase(const { | 163 const TestCase(const { |
| 164 TestMode.INPUT: "a.#nameTemplate", | 164 TestMode.INPUT: "a.#nameTemplate = #nameTemplate", |
| 165 TestMode.NONE: "a.nameValue", | 165 TestMode.NONE: "a.nameValue = nameValue", |
| 166 TestMode.ENTER: "@0@1a.@2nameValue", | 166 TestMode.ENTER: "@0@1@2a.@3nameValue = @3nameValue", |
| 167 TestMode.DELIMITER: "a.nameValue", | 167 TestMode.DELIMITER: "a.nameValue = nameValue", |
| 168 TestMode.EXIT: "a@1.nameValue@2@0", | 168 TestMode.EXIT: "a@2.nameValue@3@1 = nameValue@3@0", |
| 169 }, const {'nameTemplate': 'nameValue'}), | 169 }, const {'nameTemplate': 'nameValue'}), |
| 170 ]; | 170 ]; |
| 171 | 171 |
| 172 class FixedName extends Name { | 172 class FixedName extends Name { |
| 173 final String name; | 173 final String name; |
| 174 String get key => name; | 174 String get key => name; |
| 175 | 175 |
| 176 FixedName(this.name); | 176 FixedName(this.name); |
| 177 | 177 |
| 178 @override | 178 @override |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 if (offset < text.length) { | 247 if (offset < text.length) { |
| 248 sb.write(text.substring(offset)); | 248 sb.write(text.substring(offset)); |
| 249 } | 249 } |
| 250 return sb.toString(); | 250 return sb.toString(); |
| 251 } | 251 } |
| 252 } | 252 } |
| 253 | 253 |
| 254 void main() { | 254 void main() { |
| 255 DATA.forEach(check); | 255 DATA.forEach(check); |
| 256 } | 256 } |
| OLD | NEW |