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

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

Issue 2653203002: Use entities in CommonElements interface. (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « pkg/compiler/lib/src/typechecker.dart ('k') | tests/compiler/dart2js/mock_compiler.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 elements are not needlessly required by dart2js. 5 // Test that elements are not needlessly required by dart2js.
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/elements/elements.dart'; 9 import 'package:compiler/src/elements/elements.dart';
10 import 'package:compiler/src/enqueue.dart'; 10 import 'package:compiler/src/enqueue.dart';
(...skipping 26 matching lines...) Expand all
37 {bool proxyConstantComputed: false, bool deprecatedClass: false}) async { 37 {bool proxyConstantComputed: false, bool deprecatedClass: false}) async {
38 CompilationResult result = await runCompiler( 38 CompilationResult result = await runCompiler(
39 memorySourceFiles: {'main.dart': code}, options: ['--analyze-only']); 39 memorySourceFiles: {'main.dart': code}, options: ['--analyze-only']);
40 Expect.isTrue(result.isSuccess); 40 Expect.isTrue(result.isSuccess);
41 Compiler compiler = result.compiler; 41 Compiler compiler = result.compiler;
42 Expect.equals( 42 Expect.equals(
43 proxyConstantComputed, 43 proxyConstantComputed,
44 compiler.resolution.wasProxyConstantComputedTestingOnly, 44 compiler.resolution.wasProxyConstantComputedTestingOnly,
45 "Unexpected computation of proxy constant."); 45 "Unexpected computation of proxy constant.");
46 46
47 LibraryElement coreLibrary = compiler.commonElements.coreLibrary;
47 checkInstantiated( 48 checkInstantiated(
48 compiler, 49 compiler, coreLibrary.find('_Proxy'), proxyConstantComputed);
49 compiler.commonElements.coreLibrary.find('_Proxy'), 50 checkInstantiated(compiler, coreLibrary.find('Deprecated'), deprecatedClass);
50 proxyConstantComputed);
51 checkInstantiated(compiler,
52 compiler.commonElements.coreLibrary.find('Deprecated'), deprecatedClass);
53 51
54 LibraryElement jsHelperLibrary = 52 LibraryElement jsHelperLibrary =
55 compiler.libraryLoader.lookupLibrary(BackendHelpers.DART_JS_HELPER); 53 compiler.libraryLoader.lookupLibrary(BackendHelpers.DART_JS_HELPER);
56 jsHelperLibrary.forEachLocalMember((Element element) { 54 jsHelperLibrary.forEachLocalMember((Element element) {
57 Uri uri = element.compilationUnit.script.resourceUri; 55 Uri uri = element.compilationUnit.script.resourceUri;
58 if (element.isClass && uri.path.endsWith('annotations.dart')) { 56 if (element.isClass && uri.path.endsWith('annotations.dart')) {
59 checkInstantiated(compiler, element, false); 57 checkInstantiated(compiler, element, false);
60 } 58 }
61 }); 59 });
62 } 60 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/typechecker.dart ('k') | tests/compiler/dart2js/mock_compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698