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 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
6 import "package:compiler/src/js/js.dart"; | 6 import "package:compiler/src/js/js.dart"; |
7 import "package:compiler/src/js/rewrite_async.dart"; | 7 import "package:compiler/src/js/rewrite_async.dart"; |
8 import "package:compiler/src/js_backend/js_backend.dart" show StringBackedName; | 8 import "package:compiler/src/js_backend/js_backend.dart" show StringBackedName; |
9 | 9 |
10 import "backend_dart/dart_printer_test.dart" show PrintDiagnosticListener; | |
11 | |
12 void testTransform(String source, String expected, AsyncRewriterBase rewriter) { | 10 void testTransform(String source, String expected, AsyncRewriterBase rewriter) { |
13 Fun fun = js(source); | 11 Fun fun = js(source); |
14 Fun rewritten = rewriter.rewrite(fun); | 12 Fun rewritten = rewriter.rewrite(fun); |
15 | 13 |
16 JavaScriptPrintingOptions options = new JavaScriptPrintingOptions(); | 14 JavaScriptPrintingOptions options = new JavaScriptPrintingOptions(); |
17 SimpleJavaScriptPrintingContext context = | 15 SimpleJavaScriptPrintingContext context = |
18 new SimpleJavaScriptPrintingContext(); | 16 new SimpleJavaScriptPrintingContext(); |
19 Printer printer = new Printer(options, context); | 17 Printer printer = new Printer(options, context); |
20 printer.visit(rewritten); | 18 printer.visit(rewritten); |
21 Expect.stringEquals(expected, context.getText()); | 19 Expect.stringEquals(expected, context.getText()); |
(...skipping 1209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1231 // return | 1229 // return |
1232 return endOfIteration(); | 1230 return endOfIteration(); |
1233 case 2: | 1231 case 2: |
1234 // rethrow | 1232 // rethrow |
1235 return uncaughtError(__currentError); | 1233 return uncaughtError(__currentError); |
1236 } | 1234 } |
1237 }; | 1235 }; |
1238 }); | 1236 }); |
1239 }"""); | 1237 }"""); |
1240 } | 1238 } |
OLD | NEW |