| 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);
|
| + }
|
| + });
|
| }
|
|
|