| 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 // Partial test that the closed world computed from [WorldImpact]s derived from | 5 // Partial test that the closed world computed from [WorldImpact]s derived from |
| 6 // kernel is equivalent to the original computed from resolution. | 6 // kernel is equivalent to the original computed from resolution. |
| 7 library dart2js.kernel.compile_from_dill_test; | 7 library dart2js.kernel.compile_from_dill_test; |
| 8 | 8 |
| 9 import 'dart:async'; | 9 import 'dart:async'; |
| 10 import 'dart:io'; | 10 import 'dart:io'; |
| 11 | 11 |
| 12 import 'package:async_helper/async_helper.dart'; | 12 import 'package:async_helper/async_helper.dart'; |
| 13 import 'package:compiler/compiler_new.dart'; | 13 import 'package:compiler/compiler_new.dart'; |
| 14 import 'package:compiler/src/commandline_options.dart'; | 14 import 'package:compiler/src/commandline_options.dart'; |
| 15 import 'package:compiler/src/common.dart'; | 15 import 'package:compiler/src/common.dart'; |
| 16 import 'package:compiler/src/compiler.dart'; | 16 import 'package:compiler/src/compiler.dart'; |
| 17 import 'package:compiler/src/elements/elements.dart'; |
| 17 import 'package:compiler/src/elements/types.dart'; | 18 import 'package:compiler/src/elements/types.dart'; |
| 18 import 'package:compiler/src/kernel/element_map.dart'; | 19 import 'package:compiler/src/kernel/element_map.dart'; |
| 19 import 'package:compiler/src/kernel/kernel_strategy.dart'; | 20 import 'package:compiler/src/kernel/kernel_strategy.dart'; |
| 20 import 'package:compiler/src/serialization/equivalence.dart'; | 21 import 'package:compiler/src/serialization/equivalence.dart'; |
| 21 import 'package:compiler/src/resolution/enum_creator.dart'; | 22 import 'package:compiler/src/resolution/enum_creator.dart'; |
| 22 import 'package:compiler/src/universe/world_builder.dart'; | 23 import 'package:compiler/src/universe/world_builder.dart'; |
| 23 import 'package:compiler/src/world.dart'; | 24 import 'package:compiler/src/world.dart'; |
| 24 import 'package:expect/expect.dart'; | 25 import 'package:expect/expect.dart'; |
| 25 import '../memory_compiler.dart'; | 26 import '../memory_compiler.dart'; |
| 26 import '../equivalence/check_functions.dart'; | 27 import '../equivalence/check_functions.dart'; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 if (arguments.uri != null) { | 74 if (arguments.uri != null) { |
| 74 entryPoint = arguments.uri; | 75 entryPoint = arguments.uri; |
| 75 memorySourceFiles = const <String, String>{}; | 76 memorySourceFiles = const <String, String>{}; |
| 76 } else { | 77 } else { |
| 77 entryPoint = Uri.parse('memory:main.dart'); | 78 entryPoint = Uri.parse('memory:main.dart'); |
| 78 memorySourceFiles = SOURCE; | 79 memorySourceFiles = SOURCE; |
| 79 } | 80 } |
| 80 | 81 |
| 81 enableDebugMode(); | 82 enableDebugMode(); |
| 82 EnumCreator.matchKernelRepresentationForTesting = true; | 83 EnumCreator.matchKernelRepresentationForTesting = true; |
| 84 Elements.usePatchedDart2jsSdkSorting = true; |
| 83 | 85 |
| 84 Directory dir = await Directory.systemTemp.createTemp('dart2js-with-dill'); | 86 Directory dir = await Directory.systemTemp.createTemp('dart2js-with-dill'); |
| 85 print('--- create temp directory $dir -------------------------------'); | 87 print('--- create temp directory $dir -------------------------------'); |
| 86 memorySourceFiles.forEach((String name, String source) { | 88 memorySourceFiles.forEach((String name, String source) { |
| 87 new File.fromUri(dir.uri.resolve(name)).writeAsStringSync(source); | 89 new File.fromUri(dir.uri.resolve(name)).writeAsStringSync(source); |
| 88 }); | 90 }); |
| 89 entryPoint = dir.uri.resolve(entryPoint.path); | 91 entryPoint = dir.uri.resolve(entryPoint.path); |
| 90 | 92 |
| 91 print('---- compile from ast ----------------------------------------------'); | 93 print('---- compile from ast ----------------------------------------------'); |
| 92 DiagnosticCollector collector = new DiagnosticCollector(); | 94 DiagnosticCollector collector = new DiagnosticCollector(); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 } | 193 } |
| 192 Map<String, BufferedOutputSink> map2 = collector2.outputMap[outputType]; | 194 Map<String, BufferedOutputSink> map2 = collector2.outputMap[outputType]; |
| 193 checkSets(map1.keys, map2.keys, 'output', equality); | 195 checkSets(map1.keys, map2.keys, 'output', equality); |
| 194 map1.forEach((String name, BufferedOutputSink output1) { | 196 map1.forEach((String name, BufferedOutputSink output1) { |
| 195 BufferedOutputSink output2 = map2[name]; | 197 BufferedOutputSink output2 = map2[name]; |
| 196 Expect.stringEquals(output1.text, output2.text); | 198 Expect.stringEquals(output1.text, output2.text); |
| 197 }); | 199 }); |
| 198 }); | 200 }); |
| 199 return ResultKind.success; | 201 return ResultKind.success; |
| 200 } | 202 } |
| OLD | NEW |