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

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

Issue 219333005: Record the dependency of a implicit constructor to its superclass. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/world.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 import 'package:expect/expect.dart';
6 import "package:async_helper/async_helper.dart";
7 import 'memory_source_file_helper.dart';
8 import "dart:async";
9
10 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart'
11 as dart2js;
12
13 class FakeOutputStream<T> extends EventSink<T> {
14 void add(T event) {}
15 void addError(T event, [StackTrace stackTrace]) {}
16 void close() {}
17 }
18
19 runTest(String mainScript, test) {
20 Uri script = currentDirectory.resolveUri(Platform.script);
21 Uri libraryRoot = script.resolve('../../../sdk/');
22 Uri packageRoot = script.resolve('./packages/');
23
24 var provider = new MemorySourceFileProvider(MEMORY_SOURCE_FILES);
25 var handler = new FormattingDiagnosticHandler(provider);
26
27 Compiler compiler = new Compiler(provider.readStringFromUri,
28 (name, extension) => new FakeOutputStream(),
29 handler.diagnosticHandler,
30 libraryRoot,
31 packageRoot,
32 [],
33 {});
34 asyncTest(() => compiler.run(Uri.parse(mainScript))
35 .then((_) => test(compiler)));
Johnni Winther 2014/04/01 05:46:21 Most of this code could reuse the 'compilerFor' in
sigurdm 2014/04/01 07:36:03 Great - just what I needed
36 }
37
38 void main() {
39 runTest('memory:main.dart', (compiler) {
40 var main = compiler.mainApp.find(dart2js.Compiler.MAIN);
41 Expect.isNotNull(main, "Could not find 'main'");
42 compiler.deferredLoadTask.onResolutionComplete(main);
43
44 var outputUnitForElement = compiler.deferredLoadTask.outputUnitForElement;
45
46 var lib = compiler.libraries["memory:lib.dart"];
47 var a = lib.find("a");
48 var b = lib.find("b");
49 var c = lib.find("c");
50 var d = lib.find("d");
51 Expect.equals(outputUnitForElement(a), outputUnitForElement(b));
52 Expect.equals(outputUnitForElement(a), outputUnitForElement(c));
53 Expect.equals(outputUnitForElement(a), outputUnitForElement(d));
54 });
55 }
56
57 // Make sure that the implicit references to supers are found by the deferred
58 // loading dependency mechanism.
59 const Map MEMORY_SOURCE_FILES = const {
60 "main.dart":"""
61 import "lib.dart" deferred as lib;
62
63 void main() {
64 lib.loadLibrary().then((_) {
65 new lib.A2();
66 new lib.B2();
67 new lib.C3();
68 new lib.D3(10);
69 });
70 }
71 """,
72 "lib.dart":"""
73 a() => print("123");
74
75 b() => print("123");
76
77 c() => print("123");
78
79 d() => print("123");
80
81 class B {
82 B() {
83 b();
84 }
85 }
86
87 class B2 extends B {
88 // No constructor creates a synthetic constructor that has an implicit
89 // super-call.
90 }
91
92 class A {
93 A() {
94 a();
95 }
96 }
97
98 class A2 extends A {
99 // Implicit super call.
100 A2();
101 }
102
103 class C1 {}
104
105 class C2 {
106 C2() {
107 c();
108 }
109 }
110
111 class C2p {
112 C2() {
113 c();
114 }
115 }
116
117 class C3 extends C2 with C1 {
118 // Implicit redirecting "super" call via mixin.
119 }
120
121 class D1 {
122 }
123
124 class D2 {
125 D2(x) {
126 d();
127 }
128 }
129
130 // Implicit redirecting "super" call with a parameter via mixin.
131 class D3 = D2 with D1;
132 """,
133 };
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/world.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698