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

Side by Side Diff: tests/language_strong/compile_time_constant_i_test.dart

Issue 2994383002: Migrating block 50, first commit, after tool has run (Closed)
Patch Set: formatting Created 3 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
(Empty)
1 // Copyright (c) 2012, 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 A {
8 final x;
9 const A(this.x);
10 const A.redirect(x) : this(x + 1);
11 const A.optional([this.x = 5]);
12 }
13
14 class B extends A {
15 const B(x, this.y) : super(x);
16 const B.redirect(x, y) : this(x + 22, y + 22);
17 const B.redirect2(x, y) : this.redirect3(x + 122, y + 122);
18 const B.redirect3(x, y)
19 : this.y = y,
20 super.redirect(x);
21 const B.optional(x, [this.y]) : super(x);
22 const B.optional2([x, this.y]) : super(x);
23 final y;
24 }
25
26 class C extends B {
27 const C(x, y, this.z) : super(x, y);
28 const C.redirect(x, y, z) : this(x + 33, y + 33, z + 33);
29 const C.redirect2(x, y, z) : this.redirect3(x + 333, y + 333, z + 333);
30 const C.redirect3(x, y, z)
31 : this.z = z,
32 super.redirect2(x, y);
33 const C.optional(x, [y, this.z]) : super(x, y);
34 const C.optional2([x, y, z])
35 : this.z = z,
36 super(x, y);
37 const C.optional3([this.z]) : super.optional2();
38 final z;
39 }
40
41 const a1 = const A(499);
42 const a2 = const A.redirect(10499);
43 const a3 = const A.optional();
44 const a1b = const A.redirect(498);
45 const a3b = const A(5);
46
47 const b1 = const B(99499, -99499);
48 const b2 = const B.redirect(1234, 5678);
49 const b3 = const B.redirect2(112233, 556677);
50 const b4 = const B.redirect3(332211, 776655);
51 const b5 = const B.optional(43526);
52 const b6 = const B.optional2(8642, 9753);
53 const b3b = const B(112233 + 122 + 1, 556677 + 122);
54 const b6b = const B(8642, 9753);
55
56 const c1 = const C(121, 232, 343);
57 const c2 = const C.redirect(12321, 23432, 34543);
58 const c3 = const C.redirect2(32123, 43234, 54345);
59 const c4 = const C.redirect3(313, 424, 535);
60 const c5 = const C.optional(191, 181, 171);
61 const c6 = const C.optional(-191);
62 const c7 = const C.optional2();
63 const c8 = const C.optional3(9911);
64 const c3b = const C(32123 + 333 + 122 + 1, 43234 + 333 + 122, 54345 + 333);
65
66 main() {
67 Expect.equals(499, a1.x);
68 Expect.equals(10500, a2.x);
69 Expect.equals(5, a3.x);
70 Expect.identical(a1, a1b);
71 Expect.identical(a3, a3b);
72
73 Expect.equals(99499, b1.x);
74 Expect.equals(-99499, b1.y);
75 Expect.equals(1256, b2.x);
76 Expect.equals(5700, b2.y);
77 Expect.equals(112233 + 122 + 1, b3.x);
78 Expect.equals(556677 + 122, b3.y);
79 Expect.equals(332211 + 1, b4.x);
80 Expect.equals(776655, b4.y);
81 Expect.equals(43526, b5.x);
82 Expect.equals(null, b5.y);
83 Expect.equals(8642, b6.x);
84 Expect.equals(9753, b6.y);
85 Expect.identical(b3, b3b);
86 Expect.identical(b6, b6b);
87
88 Expect.equals(121, c1.x);
89 Expect.equals(232, c1.y);
90 Expect.equals(343, c1.z);
91 Expect.equals(12321 + 33, c2.x);
92 Expect.equals(23432 + 33, c2.y);
93 Expect.equals(34543 + 33, c2.z);
94 Expect.equals(32123 + 333 + 122 + 1, c3.x);
95 Expect.equals(43234 + 333 + 122, c3.y);
96 Expect.equals(54345 + 333, c3.z);
97 Expect.equals(313 + 122 + 1, c4.x);
98 Expect.equals(424 + 122, c4.y);
99 Expect.equals(535, c4.z);
100 Expect.equals(191, c5.x);
101 Expect.equals(181, c5.y);
102 Expect.equals(171, c5.z);
103 Expect.equals(-191, c6.x);
104 Expect.equals(null, c6.y);
105 Expect.equals(null, c6.z);
106 Expect.equals(null, c7.x);
107 Expect.equals(null, c7.y);
108 Expect.equals(null, c7.z);
109 Expect.equals(null, c8.x);
110 Expect.equals(null, c8.y);
111 Expect.equals(9911, c8.z);
112 Expect.identical(c3, c3b);
113 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698