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 26 matching lines...) Expand all Loading... |
37 abstract class B implements A { | 37 abstract class B implements A { |
38 factory B.a() => null; | 38 factory B.a() => null; |
39 } | 39 } |
40 class C implements B { | 40 class C implements B { |
41 // redirecting factory in concrete to other class | 41 // redirecting factory in concrete to other class |
42 factory C.a() = D.a; | 42 factory C.a() = D.a; |
43 } | 43 } |
44 class D implements C { | 44 class D implements C { |
45 D.a(); | 45 D.a(); |
46 } | 46 } |
47 main() { | 47 main(args) { |
48 new A.a(); | 48 new A.a(); |
49 new A.b(); | 49 new A.b(); |
50 new C.a(); | 50 new C.a(); |
51 print(new List<String>()..add('Hello World!')); | 51 print(new List<String>()..add('Hello World!')); |
52 } | 52 } |
53 ''' | 53 ''' |
54 }; | 54 }; |
55 | 55 |
56 main(List<String> args) { | 56 main(List<String> args) { |
57 Arguments arguments = new Arguments.from(args); | 57 Arguments arguments = new Arguments.from(args); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 backend, | 95 backend, |
96 compiler.commonElements, | 96 compiler.commonElements, |
97 compiler.cacheStrategy, | 97 compiler.cacheStrategy, |
98 'enqueuer from kernel'); | 98 'enqueuer from kernel'); |
99 // TODO(johnniwinther): Store backend info separately. This replacement is | 99 // TODO(johnniwinther): Store backend info separately. This replacement is |
100 // made to reset a field in [TypeVariableHandler] that prevents it from | 100 // made to reset a field in [TypeVariableHandler] that prevents it from |
101 // enqueuing twice. | 101 // enqueuing twice. |
102 backend.typeVariableHandler = new TypeVariableHandler(compiler); | 102 backend.typeVariableHandler = new TypeVariableHandler(compiler); |
103 | 103 |
104 backend.enqueueHelpers(enqueuer); | 104 backend.enqueueHelpers(enqueuer); |
105 enqueuer.addToWorkList(compiler.mainFunction); | 105 enqueuer.applyImpact( |
| 106 compiler.impactStrategy, |
| 107 enqueuer.nativeEnqueuer |
| 108 .processNativeClasses(compiler.libraryLoader.libraries)); |
| 109 enqueuer.applyImpact(compiler.impactStrategy, |
| 110 backend.computeMainImpact(enqueuer, compiler.mainFunction)); |
106 enqueuer.forEach((work) { | 111 enqueuer.forEach((work) { |
107 AstElement element = work.element; | 112 AstElement element = work.element; |
108 ResolutionImpact resolutionImpact = build(compiler, element.resolvedAst); | 113 ResolutionImpact resolutionImpact = build(compiler, element.resolvedAst); |
109 WorldImpact worldImpact = compiler.backend.impactTransformer | 114 WorldImpact worldImpact = compiler.backend.impactTransformer |
110 .transformResolutionImpact(enqueuer, resolutionImpact); | 115 .transformResolutionImpact(enqueuer, resolutionImpact); |
111 enqueuer.registerProcessedElement(element); | 116 enqueuer.registerProcessedElement(element); |
112 enqueuer.applyImpact(compiler.impactStrategy, worldImpact, | 117 enqueuer.applyImpact(compiler.impactStrategy, worldImpact, |
113 impactSource: element); | 118 impactSource: element); |
114 }); | 119 }); |
115 ClosedWorld closedWorld = | 120 ClosedWorld closedWorld = |
(...skipping 15 matching lines...) Expand all Loading... |
131 } | 136 } |
132 // The class cannot itself be instantiated. | 137 // The class cannot itself be instantiated. |
133 return false; | 138 return false; |
134 } | 139 } |
135 return true; | 140 return true; |
136 }, verbose: arguments.verbose); | 141 }, verbose: arguments.verbose); |
137 checkClosedWorlds(compiler.closedWorld, closedWorld, | 142 checkClosedWorlds(compiler.closedWorld, closedWorld, |
138 verbose: arguments.verbose); | 143 verbose: arguments.verbose); |
139 }); | 144 }); |
140 } | 145 } |
OLD | NEW |