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

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

Issue 1235563003: Add interfaces for a new compiler API. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Rebased Created 5 years, 5 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 that constants depended on by other constants are correctly deferred. 5 // Test that constants depended on by other constants are correctly deferred.
6 6
7 import 'dart:async';
8 import 'package:async_helper/async_helper.dart'; 7 import 'package:async_helper/async_helper.dart';
9 import 'package:compiler/src/constants/values.dart'; 8 import 'package:compiler/src/constants/values.dart';
9 import 'package:compiler/src/dart2jslib.dart';
10 import 'package:expect/expect.dart'; 10 import 'package:expect/expect.dart';
11 import 'memory_source_file_helper.dart'; 11 import 'memory_compiler.dart';
12
13
14 class FakeOutputStream<T> extends EventSink<T> {
15 void add(T event) {}
16 void addError(T event, [StackTrace stackTrace]) {}
17 void close() {}
18 }
19 12
20 void main() { 13 void main() {
21 Uri script = currentDirectory.resolveUri(Platform.script); 14 Compiler compiler = compilerFor(MEMORY_SOURCE_FILES);
22 Uri libraryRoot = script.resolve('../../../sdk/');
23 Uri packageRoot = script.resolve('./packages/');
24
25 var provider = new MemorySourceFileProvider(MEMORY_SOURCE_FILES);
26 var handler = new FormattingDiagnosticHandler(provider);
27
28 Compiler compiler = new Compiler(provider.readStringFromUri,
29 (name, extension) => new FakeOutputStream(),
30 handler.diagnosticHandler,
31 libraryRoot,
32 packageRoot,
33 [],
34 {});
35 asyncTest(() => compiler.run(Uri.parse('memory:main.dart')).then((_) { 15 asyncTest(() => compiler.run(Uri.parse('memory:main.dart')).then((_) {
36 var outputUnitForElement = compiler.deferredLoadTask.outputUnitForElement; 16 var outputUnitForElement = compiler.deferredLoadTask.outputUnitForElement;
37 var outputUnitForConstant = compiler.deferredLoadTask.outputUnitForConstant; 17 var outputUnitForConstant = compiler.deferredLoadTask.outputUnitForConstant;
38 var mainOutputUnit = compiler.deferredLoadTask.mainOutputUnit; 18 var mainOutputUnit = compiler.deferredLoadTask.mainOutputUnit;
39 var lib = 19 var lib =
40 compiler.libraryLoader.lookupLibrary(Uri.parse("memory:lib.dart")); 20 compiler.libraryLoader.lookupLibrary(Uri.parse("memory:lib.dart"));
41 var backend = compiler.backend; 21 var backend = compiler.backend;
42 List<ConstantValue> allConstants = []; 22 List<ConstantValue> allConstants = [];
43 23
44 addConstantWithDependendencies(ConstantValue c) { 24 addConstantWithDependendencies(ConstantValue c) {
(...skipping 30 matching lines...) Expand all
75 print(lib.L); 55 print(lib.L);
76 } 56 }
77 """, "lib.dart": """ 57 """, "lib.dart": """
78 class C { 58 class C {
79 final a; 59 final a;
80 const C(this.a); 60 const C(this.a);
81 } 61 }
82 62
83 const L = const {"cA": const C(const {"cB": "cC"})}; 63 const L = const {"cA": const C(const {"cB": "cC"})};
84 """,}; 64 """,};
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698