| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'package:async_helper/async_helper.dart'; | 6 import 'package:async_helper/async_helper.dart'; |
| 7 import 'package:compiler/src/commandline_options.dart'; | 7 import 'package:compiler/src/commandline_options.dart'; |
| 8 import 'package:compiler/src/common.dart'; | 8 import 'package:compiler/src/common.dart'; |
| 9 import 'package:compiler/src/compiler.dart'; | 9 import 'package:compiler/src/compiler.dart'; |
| 10 import 'package:compiler/src/kernel/kernel_backend_strategy.dart'; |
| 10 import 'package:compiler/src/js_model/js_strategy.dart'; | 11 import 'package:compiler/src/js_model/js_strategy.dart'; |
| 11 import 'package:expect/expect.dart'; | 12 import 'package:expect/expect.dart'; |
| 12 import '../kernel/compiler_helper.dart'; | 13 import '../kernel/compiler_helper.dart'; |
| 13 import '../serialization/helper.dart'; | 14 import '../serialization/helper.dart'; |
| 14 | 15 |
| 15 const Map<String, String> SOURCE = const <String, String>{ | 16 const Map<String, String> SOURCE = const <String, String>{ |
| 16 'main.dart': r''' | 17 'main.dart': r''' |
| 17 main() {} | 18 main() {} |
| 18 ''' | 19 ''' |
| 19 }; | 20 }; |
| 20 | 21 |
| 21 main(List<String> args) { | 22 main(List<String> args) { |
| 23 useJsStrategyForTesting = true; |
| 22 asyncTest(() async { | 24 asyncTest(() async { |
| 23 await mainInternal(args); | 25 await mainInternal(args); |
| 24 }); | 26 }); |
| 25 } | 27 } |
| 26 | 28 |
| 27 Future mainInternal(List<String> args, | 29 Future mainInternal(List<String> args, |
| 28 {bool skipWarnings: false, bool skipErrors: false}) async { | 30 {bool skipWarnings: false, bool skipErrors: false}) async { |
| 29 Arguments arguments = new Arguments.from(args); | 31 Arguments arguments = new Arguments.from(args); |
| 30 Uri entryPoint; | 32 Uri entryPoint; |
| 31 Map<String, String> memorySourceFiles; | 33 Map<String, String> memorySourceFiles; |
| 32 if (arguments.uri != null) { | 34 if (arguments.uri != null) { |
| 33 entryPoint = arguments.uri; | 35 entryPoint = arguments.uri; |
| 34 memorySourceFiles = const <String, String>{}; | 36 memorySourceFiles = const <String, String>{}; |
| 35 } else { | 37 } else { |
| 36 entryPoint = Uri.parse('memory:main.dart'); | 38 entryPoint = Uri.parse('memory:main.dart'); |
| 37 memorySourceFiles = SOURCE; | 39 memorySourceFiles = SOURCE; |
| 38 } | 40 } |
| 39 | 41 |
| 40 enableDebugMode(); | 42 enableDebugMode(); |
| 41 | 43 |
| 42 Compiler compiler1 = await compileWithDill(entryPoint, memorySourceFiles, [ | 44 Compiler compiler1 = await compileWithDill(entryPoint, memorySourceFiles, [ |
| 43 Flags.disableInlining, | 45 Flags.disableInlining, |
| 44 Flags.disableTypeInference | 46 Flags.disableTypeInference |
| 45 ], beforeRun: (Compiler compiler) { | 47 ], beforeRun: (Compiler compiler) { |
| 46 compiler.backendStrategy = new JsBackendStrategy(compiler); | 48 compiler.backendStrategy = new JsBackendStrategy(compiler); |
| 47 }, printSteps: true); | 49 }, printSteps: true); |
| 48 Expect.isFalse(compiler1.compilationFailed); | 50 Expect.isFalse(compiler1.compilationFailed); |
| 49 } | 51 } |
| OLD | NEW |