Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Side by Side Diff: tests/compiler/dart2js/kernel/closed_world_test.dart

Issue 2944843002: All strong mode cleaning of dart2js. (Closed)
Patch Set: More issues discovered during testing. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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';
11 import 'package:compiler/src/common.dart'; 11 import 'package:compiler/src/common.dart';
12 import 'package:compiler/src/common_elements.dart'; 12 import 'package:compiler/src/common_elements.dart';
13 import 'package:compiler/src/common/backend_api.dart';
14 import 'package:compiler/src/common/resolution.dart';
15 import 'package:compiler/src/common/work.dart'; 13 import 'package:compiler/src/common/work.dart';
16 import 'package:compiler/src/compiler.dart'; 14 import 'package:compiler/src/compiler.dart';
17 import 'package:compiler/src/elements/resolution_types.dart';
18 import 'package:compiler/src/elements/elements.dart';
19 import 'package:compiler/src/elements/entities.dart';
20 import 'package:compiler/src/enqueue.dart'; 15 import 'package:compiler/src/enqueue.dart';
21 import 'package:compiler/src/js_backend/backend.dart'; 16 import 'package:compiler/src/js_backend/backend.dart';
22 import 'package:compiler/src/js_backend/backend_usage.dart'; 17 import 'package:compiler/src/js_backend/backend_usage.dart';
23 import 'package:compiler/src/js_backend/interceptor_data.dart'; 18 import 'package:compiler/src/js_backend/interceptor_data.dart';
24 import 'package:compiler/src/js_backend/resolution_listener.dart'; 19 import 'package:compiler/src/js_backend/resolution_listener.dart';
25 import 'package:compiler/src/js_backend/type_variable_handler.dart'; 20 import 'package:compiler/src/js_backend/type_variable_handler.dart';
26 import 'package:compiler/src/ssa/kernel_impact.dart';
27 import 'package:compiler/src/serialization/equivalence.dart'; 21 import 'package:compiler/src/serialization/equivalence.dart';
28 import 'package:compiler/src/universe/world_builder.dart'; 22 import 'package:compiler/src/universe/world_builder.dart';
29 import 'package:compiler/src/universe/world_impact.dart'; 23 import 'package:compiler/src/universe/world_impact.dart';
30 import 'package:compiler/src/world.dart'; 24 import 'package:compiler/src/world.dart';
31 import 'impact_test.dart';
32 import '../memory_compiler.dart'; 25 import '../memory_compiler.dart';
33 import '../serialization/helper.dart'; 26 import '../serialization/helper.dart';
34 import '../serialization/model_test_helper.dart';
35 import '../equivalence/check_functions.dart'; 27 import '../equivalence/check_functions.dart';
36 import 'test_helpers.dart'; 28 import 'test_helpers.dart';
37 29
38 const SOURCE = const { 30 const SOURCE = const {
39 'main.dart': ''' 31 'main.dart': '''
40 abstract class A { 32 abstract class A {
41 // redirecting factory in abstract class to other class 33 // redirecting factory in abstract class to other class
42 factory A.a() = D.a; 34 factory A.a() = D.a;
43 // redirecting factory in abstract class to factory in abstract class 35 // redirecting factory in abstract class to factory in abstract class
44 factory A.b() = B.a; 36 factory A.b() = B.a;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 interceptorDataBuilder, 102 interceptorDataBuilder,
111 backendUsageBuilder, 103 backendUsageBuilder,
112 const OpenWorldStrategy()), 104 const OpenWorldStrategy()),
113 new KernelTestWorkItemBuilder(compiler), 105 new KernelTestWorkItemBuilder(compiler),
114 'enqueuer from kernel'); 106 'enqueuer from kernel');
115 ClosedWorld closedWorld = computeClosedWorld(compiler.reporter, enqueuer, 107 ClosedWorld closedWorld = computeClosedWorld(compiler.reporter, enqueuer,
116 compiler.frontendStrategy.elementEnvironment); 108 compiler.frontendStrategy.elementEnvironment);
117 BackendUsage backendUsage = backendUsageBuilder.close(); 109 BackendUsage backendUsage = backendUsageBuilder.close();
118 checkResolutionEnqueuers( 110 checkResolutionEnqueuers(
119 backendUsage, backendUsage, compiler.enqueuer.resolution, enqueuer, 111 backendUsage, backendUsage, compiler.enqueuer.resolution, enqueuer,
120 typeEquivalence: (ResolutionDartType a, ResolutionDartType b) { 112 typeEquivalence: (a, b) => areTypesEquivalent(unalias(a), unalias(b)),
121 return areTypesEquivalent(unalias(a), unalias(b));
122 },
123 elementFilter: elementFilter, 113 elementFilter: elementFilter,
124 verbose: arguments.verbose, 114 verbose: arguments.verbose,
125 // TODO(johnniwinther): Support class usage testing in presence of 115 // TODO(johnniwinther): Support class usage testing in presence of
126 // redirecting constructors. 116 // redirecting constructors.
127 skipClassUsageTesting: true); 117 skipClassUsageTesting: true);
128 checkClosedWorlds( 118 checkClosedWorlds(
129 compiler.resolutionWorldBuilder.closedWorldForTesting, closedWorld, 119 compiler.resolutionWorldBuilder.closedWorldForTesting, closedWorld,
130 verbose: arguments.verbose); 120 verbose: arguments.verbose);
131 }); 121 });
132 } 122 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 156
167 ClosedWorld computeClosedWorld(DiagnosticReporter reporter, 157 ClosedWorld computeClosedWorld(DiagnosticReporter reporter,
168 ResolutionEnqueuer enqueuer, ElementEnvironment elementEnvironment) { 158 ResolutionEnqueuer enqueuer, ElementEnvironment elementEnvironment) {
169 enqueuer.open(const ImpactStrategy(), elementEnvironment.mainFunction, 159 enqueuer.open(const ImpactStrategy(), elementEnvironment.mainFunction,
170 elementEnvironment.libraries); 160 elementEnvironment.libraries);
171 enqueuer.forEach((WorkItem work) { 161 enqueuer.forEach((WorkItem work) {
172 enqueuer.applyImpact(work.run(), impactSource: work.element); 162 enqueuer.applyImpact(work.run(), impactSource: work.element);
173 }); 163 });
174 return enqueuer.worldBuilder.closeWorld(); 164 return enqueuer.worldBuilder.closeWorld();
175 } 165 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698