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

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

Issue 1299413002: Move common identifiers, names and selectors to a separate library. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 of the graph segmentation algorithm used by deferred loading 5 // Test of the graph segmentation algorithm used by deferred loading
6 // to determine which elements can be deferred and which libraries 6 // to determine which elements can be deferred and which libraries
7 // much be included in the initial download (loaded eagerly). 7 // much be included in the initial download (loaded eagerly).
8 8
9 import 'package:async_helper/async_helper.dart'; 9 import 'package:async_helper/async_helper.dart';
10 import 'package:compiler/src/compiler.dart'; 10 import 'package:compiler/src/compiler.dart';
11 import 'package:expect/expect.dart'; 11 import 'package:expect/expect.dart';
12 import 'memory_compiler.dart'; 12 import 'memory_compiler.dart';
13 13
14 void main() { 14 void main() {
15 asyncTest(() async { 15 asyncTest(() async {
16 CompilationResult result = 16 CompilationResult result =
17 await runCompiler(memorySourceFiles: MEMORY_SOURCE_FILES); 17 await runCompiler(memorySourceFiles: MEMORY_SOURCE_FILES);
18 Compiler compiler = result.compiler; 18 Compiler compiler = result.compiler;
19 19
20 lookupLibrary(name) { 20 lookupLibrary(name) {
21 return compiler.libraryLoader.lookupLibrary(Uri.parse(name)); 21 return compiler.libraryLoader.lookupLibrary(Uri.parse(name));
22 } 22 }
23 23
24 var main = compiler.mainApp.find(Compiler.MAIN); 24 var main = compiler.mainFunction;
25 var outputUnitForElement = compiler.deferredLoadTask.outputUnitForElement; 25 var outputUnitForElement = compiler.deferredLoadTask.outputUnitForElement;
26 26
27 var mainOutputUnit = compiler.deferredLoadTask.mainOutputUnit; 27 var mainOutputUnit = compiler.deferredLoadTask.mainOutputUnit;
28 var backend = compiler.backend; 28 var backend = compiler.backend;
29 var classes = backend.emitter.neededClasses; 29 var classes = backend.emitter.neededClasses;
30 var lib1 = lookupLibrary("memory:lib1.dart"); 30 var lib1 = lookupLibrary("memory:lib1.dart");
31 var lib2 = lookupLibrary("memory:lib2.dart"); 31 var lib2 = lookupLibrary("memory:lib2.dart");
32 var foo1 = lib1.find("foo1"); 32 var foo1 = lib1.find("foo1");
33 var foo2 = lib2.find("foo2"); 33 var foo2 = lib2.find("foo2");
34 34
(...skipping 23 matching lines...) Expand all
58 void foo1() { 58 void foo1() {
59 lib1.loadLibrary().then((_) => lib2.foo2()); 59 lib1.loadLibrary().then((_) => lib2.foo2());
60 } 60 }
61 """, 61 """,
62 "lib2.dart":""" 62 "lib2.dart":"""
63 library lib2; 63 library lib2;
64 64
65 void foo2() {} 65 void foo2() {}
66 """, 66 """,
67 }; 67 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698