| 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 // Helper to test compilation equivalence between source and .dill based | 5 // Helper to test compilation equivalence between source and .dill based |
| 6 // compilation. | 6 // compilation. |
| 7 library dart2js.kernel.compile_from_dill_test_helper; | 7 library dart2js.kernel.compile_from_dill_test_helper; |
| 8 | 8 |
| 9 import 'dart:async'; | 9 import 'dart:async'; |
| 10 import 'dart:io'; | 10 import 'dart:io'; |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 checkCodegenEnqueuers(compiler1.enqueuer.codegenEnqueuerForTesting, | 277 checkCodegenEnqueuers(compiler1.enqueuer.codegenEnqueuerForTesting, |
| 278 compiler2.enqueuer.codegenEnqueuerForTesting, | 278 compiler2.enqueuer.codegenEnqueuerForTesting, |
| 279 elementEquivalence: (a, b) => equivalence2.entityEquivalence(a, b), | 279 elementEquivalence: (a, b) => equivalence2.entityEquivalence(a, b), |
| 280 typeEquivalence: (DartType a, DartType b) { | 280 typeEquivalence: (DartType a, DartType b) { |
| 281 return equivalence2.typeEquivalence(unalias(a), b); | 281 return equivalence2.typeEquivalence(unalias(a), b); |
| 282 }, | 282 }, |
| 283 elementFilter: elementFilter, | 283 elementFilter: elementFilter, |
| 284 verbose: verbose); | 284 verbose: verbose); |
| 285 | 285 |
| 286 checkEmitters(compiler1.backend.emitter, compiler2.backend.emitter, | 286 checkEmitters(compiler1.backend.emitter, compiler2.backend.emitter, |
| 287 equivalence2.defaultStrategy, |
| 287 elementEquivalence: (a, b) => equivalence2.entityEquivalence(a, b), | 288 elementEquivalence: (a, b) => equivalence2.entityEquivalence(a, b), |
| 288 typeEquivalence: (DartType a, DartType b) { | 289 typeEquivalence: (DartType a, DartType b) { |
| 289 return equivalence2.typeEquivalence(unalias(a), b); | 290 return equivalence2.typeEquivalence(unalias(a), b); |
| 290 }, | 291 }, |
| 291 verbose: verbose); | 292 verbose: verbose); |
| 292 | 293 |
| 293 if (expectAstEquivalence) { | 294 if (expectAstEquivalence) { |
| 294 checkGeneratedCode(compiler1.backend, compiler2.backend, | 295 checkGeneratedCode(compiler1.backend, compiler2.backend, |
| 295 elementEquivalence: (a, b) => equivalence2.entityEquivalence(a, b)); | 296 elementEquivalence: (a, b) => equivalence2.entityEquivalence(a, b)); |
| 296 } | 297 } |
| 297 | 298 |
| 298 if (expectIdenticalOutput) { | 299 if (expectIdenticalOutput) { |
| 299 print('--- checking output------- ---------------------------------------'); | 300 print('--- checking output------- ---------------------------------------'); |
| 300 collector1.outputMap | 301 collector1.outputMap |
| 301 .forEach((OutputType outputType, Map<String, BufferedOutputSink> map1) { | 302 .forEach((OutputType outputType, Map<String, BufferedOutputSink> map1) { |
| 302 if (outputType == OutputType.sourceMap) { | 303 if (outputType == OutputType.sourceMap) { |
| 303 // TODO(johnniwinther): Support source map from .dill. | 304 // TODO(johnniwinther): Support source map from .dill. |
| 304 return; | 305 return; |
| 305 } | 306 } |
| 306 Map<String, BufferedOutputSink> map2 = collector2.outputMap[outputType]; | 307 Map<String, BufferedOutputSink> map2 = collector2.outputMap[outputType]; |
| 307 checkSets(map1.keys, map2.keys, 'output', equality); | 308 checkSets(map1.keys, map2.keys, 'output', equality); |
| 308 map1.forEach((String name, BufferedOutputSink output1) { | 309 map1.forEach((String name, BufferedOutputSink output1) { |
| 309 BufferedOutputSink output2 = map2[name]; | 310 BufferedOutputSink output2 = map2[name]; |
| 310 Expect.stringEquals(output1.text, output2.text); | 311 Expect.stringEquals(output1.text, output2.text); |
| 311 }); | 312 }); |
| 312 }); | 313 }); |
| 313 } | 314 } |
| 314 return ResultKind.success; | 315 return ResultKind.success; |
| 315 } | 316 } |
| OLD | NEW |