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

Side by Side Diff: tests/compiler/dart2js/mirror_tree_shaking_test.dart

Issue 2494093002: Refactor enqueuers (Closed)
Patch Set: Updated cf. comments. Created 4 years, 1 month 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 // Test that tree-shaking hasn't been turned off. 5 // Test that tree-shaking hasn't been turned off.
6 6
7 import 'package:async_helper/async_helper.dart'; 7 import 'package:async_helper/async_helper.dart';
8 import 'package:compiler/src/compiler.dart'; 8 import 'package:compiler/src/compiler.dart';
9 import 'package:compiler/src/js_backend/js_backend.dart' show JavaScriptBackend; 9 import 'package:compiler/src/js_backend/js_backend.dart' show JavaScriptBackend;
10 import 'package:expect/expect.dart'; 10 import 'package:expect/expect.dart';
11 import 'memory_compiler.dart'; 11 import 'memory_compiler.dart';
12 12
13 main() { 13 main() {
14 DiagnosticCollector collector = new DiagnosticCollector(); 14 DiagnosticCollector collector = new DiagnosticCollector();
15 asyncTest(() async { 15 asyncTest(() async {
16 CompilationResult result = await runCompiler( 16 CompilationResult result = await runCompiler(
17 memorySourceFiles: MEMORY_SOURCE_FILES, diagnosticHandler: collector); 17 memorySourceFiles: MEMORY_SOURCE_FILES, diagnosticHandler: collector);
18 Compiler compiler = result.compiler; 18 Compiler compiler = result.compiler;
19 JavaScriptBackend backend = compiler.backend;
19 Expect.isTrue(collector.errors.isEmpty); 20 Expect.isTrue(collector.errors.isEmpty);
20 Expect.isTrue(collector.infos.isEmpty); 21 Expect.isTrue(collector.infos.isEmpty);
21 Expect.isFalse(compiler.compilationFailed); 22 Expect.isFalse(compiler.compilationFailed);
22 Expect.isFalse(compiler.enqueuer.resolution.hasEnqueuedReflectiveElements); 23 Expect.isFalse(backend
24 .mirrorsAnalysis.resolutionHandler.hasEnqueuedReflectiveElements);
25 Expect.isFalse(backend
26 .mirrorsAnalysis.resolutionHandler.hasEnqueuedReflectiveStaticFields);
23 Expect.isFalse( 27 Expect.isFalse(
24 compiler.enqueuer.resolution.hasEnqueuedReflectiveStaticFields); 28 backend.mirrorsAnalysis.codegenHandler.hasEnqueuedReflectiveElements);
25 JavaScriptBackend backend = compiler.backend; 29 Expect.isFalse(backend
26 Expect.isFalse(backend.codegenEnqueuer.hasEnqueuedReflectiveElements); 30 .mirrorsAnalysis.codegenHandler.hasEnqueuedReflectiveStaticFields);
27 Expect.isFalse(backend.codegenEnqueuer.hasEnqueuedReflectiveStaticFields);
28 Expect.isFalse(compiler.disableTypeInference); 31 Expect.isFalse(compiler.disableTypeInference);
29 Expect.isFalse(backend.hasRetainedMetadata); 32 Expect.isFalse(backend.hasRetainedMetadata);
30 }); 33 });
31 } 34 }
32 35
33 const Map MEMORY_SOURCE_FILES = const { 36 const Map MEMORY_SOURCE_FILES = const {
34 'main.dart': r""" 37 'main.dart': r"""
35 import 'dart:mirrors'; 38 import 'dart:mirrors';
36 39
37 class Foo { 40 class Foo {
38 noSuchMethod(invocation) { 41 noSuchMethod(invocation) {
39 print('Invoked ${MirrorSystem.getName(invocation.memberName)}'); 42 print('Invoked ${MirrorSystem.getName(invocation.memberName)}');
40 return reflect('foobar').delegate(invocation); 43 return reflect('foobar').delegate(invocation);
41 } 44 }
42 } 45 }
43 46
44 void main() { 47 void main() {
45 print(new Foo().substring(3)); 48 print(new Foo().substring(3));
46 } 49 }
47 """, 50 """,
48 }; 51 };
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/deferred_load_graph_segmentation_test.dart ('k') | tests/compiler/dart2js/type_combination_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698