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

Side by Side Diff: tests/language/constructor12_test.dart

Issue 966763002: Fix order of box and types for constructor-body invocations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Added tests. Created 5 years, 9 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 | « pkg/compiler/lib/src/ssa/builder.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) 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
3 // BSD-style license that can be found in the LICENSE file.
4
5 import "package:expect/expect.dart";
6
7 class B {
8 final z;
9 B(this.z);
10
11 foo() => this.z;
12 }
13
14 class A<T> extends B {
15 var captured, captured2;
16 var typedList;
17
18 // p must be inside a box (in dart2js).
19 A(p) : captured = (() => p), super(p++) {
20 // Make non-inlinable.
21 try {} catch(e) {}
22
23 captured2 = () => p++;
24
25 // In the current implementation of dart2js makes the generic type an
26 // argument to the body.
27 typedList = <T>[];
28 }
29
30 foo() => captured();
31 bar() => captured2();
32 }
33
34 @NoInline()
35 @AssumeDynamic()
36 confuse(x) => x;
37
38 main() {
39 var a = confuse(new A<int>(1));
40 var a2 = confuse(new A(2));
41 var b = confuse(new B(3));
42 Expect.equals(2, a.foo());
43 Expect.equals(3, a2.foo());
44 Expect.equals(3, b.foo());
45 Expect.equals(1, a.z);
46 Expect.equals(2, a2.z);
47 Expect.equals(3, b.z);
48 Expect.isTrue(a is A<int>);
49 Expect.isFalse(a is A<String>);
50 Expect.isTrue(a2 is A<int>);
51 Expect.isTrue(a2 is A<String>);
52 Expect.equals(2, a.bar());
53 Expect.equals(3, a2.bar());
54 Expect.equals(3, a.foo());
55 Expect.equals(4, a2.foo());
56 Expect.equals(0, a.typedList.length);
57 Expect.equals(0, a2.typedList.length);
58 a.typedList.add(499);
59 Expect.equals(1, a.typedList.length);
60 Expect.equals(0, a2.typedList.length);
61 Expect.isTrue(a.typedList is List<int>);
62 Expect.isTrue(a2.typedList is List<int>);
63 Expect.isFalse(a.typedList is List<String>);
64 Expect.isTrue(a2.typedList is List<String>);
65 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/builder.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698