| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 // Tests that the closed world computed from [WorldImpact]s derived from kernel | 5 // Tests that the closed world computed from [WorldImpact]s derived from kernel |
| 6 // is equivalent to the original computed from resolution. | 6 // is equivalent to the original computed from resolution. |
| 7 library dart2js.kernel.closed_world_test; | 7 library dart2js.kernel.closed_world_test; |
| 8 | 8 |
| 9 import 'package:async_helper/async_helper.dart'; | 9 import 'package:async_helper/async_helper.dart'; |
| 10 import 'package:compiler/src/commandline_options.dart'; | 10 import 'package:compiler/src/commandline_options.dart'; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 enqueuer.forEach((work) { | 110 enqueuer.forEach((work) { |
| 111 AstElement element = work.element; | 111 AstElement element = work.element; |
| 112 ResolutionImpact resolutionImpact = build(compiler, element.resolvedAst); | 112 ResolutionImpact resolutionImpact = build(compiler, element.resolvedAst); |
| 113 WorldImpact worldImpact = compiler.backend.impactTransformer | 113 WorldImpact worldImpact = compiler.backend.impactTransformer |
| 114 .transformResolutionImpact(enqueuer, resolutionImpact); | 114 .transformResolutionImpact(enqueuer, resolutionImpact); |
| 115 enqueuer.applyImpact(worldImpact, impactSource: element); | 115 enqueuer.applyImpact(worldImpact, impactSource: element); |
| 116 }); | 116 }); |
| 117 ClosedWorld closedWorld = enqueuer.universe.closeWorld(compiler.reporter); | 117 ClosedWorld closedWorld = enqueuer.universe.closeWorld(compiler.reporter); |
| 118 | 118 |
| 119 checkResolutionEnqueuers(compiler.enqueuer.resolution, enqueuer, | 119 checkResolutionEnqueuers(compiler.enqueuer.resolution, enqueuer, |
| 120 typeEquivalence: (DartType a, DartType b) { | 120 typeEquivalence: (ResolutionDartType a, ResolutionDartType b) { |
| 121 return areTypesEquivalent(unalias(a), unalias(b)); | 121 return areTypesEquivalent(unalias(a), unalias(b)); |
| 122 }, elementFilter: (Element element) { | 122 }, elementFilter: (Element element) { |
| 123 if (element is ConstructorElement && element.isRedirectingFactory) { | 123 if (element is ConstructorElement && element.isRedirectingFactory) { |
| 124 // Redirecting factory constructors are skipped in kernel. | 124 // Redirecting factory constructors are skipped in kernel. |
| 125 return false; | 125 return false; |
| 126 } | 126 } |
| 127 if (element is ClassElement) { | 127 if (element is ClassElement) { |
| 128 for (ConstructorElement constructor in element.constructors) { | 128 for (ConstructorElement constructor in element.constructors) { |
| 129 if (!constructor.isRedirectingFactory) { | 129 if (!constructor.isRedirectingFactory) { |
| 130 return true; | 130 return true; |
| 131 } | 131 } |
| 132 } | 132 } |
| 133 // The class cannot itself be instantiated. | 133 // The class cannot itself be instantiated. |
| 134 return false; | 134 return false; |
| 135 } | 135 } |
| 136 return true; | 136 return true; |
| 137 }, verbose: arguments.verbose); | 137 }, verbose: arguments.verbose); |
| 138 checkClosedWorlds(compiler.resolverWorld.closedWorldForTesting, closedWorld, | 138 checkClosedWorlds(compiler.resolverWorld.closedWorldForTesting, closedWorld, |
| 139 verbose: arguments.verbose); | 139 verbose: arguments.verbose); |
| 140 }); | 140 }); |
| 141 } | 141 } |
| OLD | NEW |