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

Unified Diff: tests/compiler/dart2js/minimal_resolution_test.dart

Issue 1376863004: Avoid eager enqueueing from resolution (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Fix deferred+mirrors bug. Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/compiler/dart2js/memory_compiler.dart ('k') | tests/compiler/dart2js/related_types.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/minimal_resolution_test.dart
diff --git a/tests/compiler/dart2js/minimal_resolution_test.dart b/tests/compiler/dart2js/minimal_resolution_test.dart
index ca61f80488476083c1c8c75b676b355de71313a0..b46b3409f976686de754ee4b76154cf6df673b53 100644
--- a/tests/compiler/dart2js/minimal_resolution_test.dart
+++ b/tests/compiler/dart2js/minimal_resolution_test.dart
@@ -6,6 +6,9 @@
import 'package:async_helper/async_helper.dart';
import 'package:compiler/src/compiler.dart';
+import 'package:compiler/src/elements/elements.dart';
+import 'package:compiler/src/enqueue.dart';
+import 'package:compiler/src/js_backend/js_backend.dart';
import 'package:expect/expect.dart';
import 'memory_compiler.dart';
@@ -13,15 +16,45 @@ main() {
asyncTest(() async {
await analyze('main() {}');
await analyze('main() => proxy;', proxyConstant: true);
+ await analyze('@deprecated main() {}');
+ await analyze('@deprecated main() => deprecated;', deprecatedClass: true);
+ await analyze('main() => deprecated;', deprecatedClass: true);
});
}
+void checkInstantiated(Compiler compiler, ClassElement cls, bool expected) {
+ ResolutionEnqueuer enqueuer = compiler.enqueuer.resolution;
+ bool isInstantiated =
+ enqueuer.universe.directlyInstantiatedClasses.contains(cls);
+ bool isProcessed = enqueuer.isClassProcessed(cls);
+ Expect.equals(expected, isInstantiated,
+ 'Unexpected instantiation state of class $cls.');
+ Expect.equals(expected, isProcessed,
+ 'Unexpected processing state of class $cls.');
+}
+
analyze(String code,
- {bool proxyConstant: false}) async {
+ {bool proxyConstant: false,
+ bool deprecatedClass: false}) async {
CompilationResult result = await runCompiler(
memorySourceFiles: {'main.dart': code},
options: ['--analyze-only']);
Expect.isTrue(result.isSuccess);
Compiler compiler = result.compiler;
- Expect.equals(proxyConstant, compiler.proxyConstant != null);
+ Expect.equals(proxyConstant, compiler.proxyConstant != null,
+ "Unexpected computation of proxy constant.");
+
+ checkInstantiated(
+ compiler, compiler.coreLibrary.find('_Proxy'), proxyConstant);
+ checkInstantiated(
+ compiler, compiler.coreLibrary.find('Deprecated'), deprecatedClass);
+
+ LibraryElement jsHelperLibrary =
+ compiler.libraryLoader.lookupLibrary(JavaScriptBackend.DART_JS_HELPER);
+ jsHelperLibrary.forEachLocalMember((Element element) {
+ Uri uri = element.compilationUnit.script.resourceUri;
+ if (element.isClass && uri.path.endsWith('annotations.dart')) {
+ checkInstantiated(compiler, element, false);
+ }
+ });
}
« no previous file with comments | « tests/compiler/dart2js/memory_compiler.dart ('k') | tests/compiler/dart2js/related_types.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698