OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011, 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 void phi1() { | |
6 var x = 42; | |
7 if (true) { | |
8 Expect.equals(42, x); | |
9 print(x); | |
10 } | |
11 Expect.equals(42, x); | |
12 print(x); | |
13 } | |
14 | |
15 void phi2() { | |
16 var x = 499; | |
17 if (true) { | |
18 Expect.equals(499, x); | |
19 x = 42; | |
20 } | |
21 Expect.equals(42, x); | |
22 print(x); | |
23 } | |
24 | |
25 void phi3() { | |
26 var x = 499; | |
27 if (true) { | |
28 Expect.equals(499, x); | |
29 x = 42; | |
30 } else { | |
31 Expect.fail('unreachable'); | |
32 print(x); | |
33 } | |
34 Expect.equals(42, x); | |
35 print(x); | |
36 } | |
37 | |
38 void phi4() { | |
39 var x = 499; | |
40 if (true) { | |
41 Expect.equals(499, x); | |
42 print(x); | |
43 } else { | |
44 Expect.fail('unreachable'); | |
45 x = 42; | |
46 } | |
47 Expect.equals(499, x); | |
48 print(x); | |
49 } | |
50 | |
51 void phi5() { | |
52 var x = 499; | |
53 if (true) { | |
54 if (true) { | |
55 Expect.equals(499, x); | |
56 x = 42; | |
57 } | |
58 } | |
59 Expect.equals(42, x); | |
60 print(x); | |
61 } | |
62 | |
63 void phi6() { | |
64 var x = 499; | |
65 if (true) { | |
66 if (true) { | |
67 Expect.equals(499, x); | |
68 print(x); | |
69 } else { | |
70 x = 42; | |
71 Expect.fail('unreachable'); | |
72 } | |
73 } | |
74 Expect.equals(499, x); | |
75 print(x); | |
76 } | |
77 | |
78 void phi7() { | |
79 var x = 499; | |
80 if (true) { | |
81 x = 42; | |
82 if (true) { | |
83 Expect.equals(42, x); | |
84 x = 99; | |
85 } else { | |
86 x = 111; | |
87 Expect.fail('unreachable'); | |
88 } | |
89 } else { | |
90 Expect.fail('unreachable'); | |
91 if (false) { | |
92 x = 341; | |
93 } else { | |
94 x = 1024; | |
95 } | |
96 } | |
97 Expect.equals(99, x); | |
98 print(x); | |
99 } | |
100 | |
101 void phi8() { | |
102 var x = 499; | |
103 if (true) { | |
104 x = 42; | |
105 if (true) { | |
106 Expect.equals(42, x); | |
107 x = 99; | |
108 } else { | |
109 Expect.fail('unreachable'); | |
110 x = 111; | |
111 } | |
112 } else { | |
113 Expect.fail('unreachable'); | |
114 if (false) { | |
115 x = 341; | |
116 } else { | |
117 x = 1024; | |
118 } | |
119 } | |
120 if (true) { | |
121 Expect.equals(99, x); | |
122 x = 12342; | |
123 if (true) { | |
124 x = 12399; | |
125 } else { | |
126 Expect.fail('unreachable'); | |
127 x = 123111; | |
128 } | |
129 } else { | |
130 Expect.fail('unreachable'); | |
131 if (false) { | |
132 x = 123341; | |
133 } else { | |
134 x = 1231024; | |
135 } | |
136 } | |
137 Expect.equals(12399, x); | |
138 print(x); | |
139 } | |
140 | |
141 void phi9() { | |
142 var x = 499; | |
143 if (true) { | |
144 var y = 42; | |
145 if (true) { | |
146 y = 99; | |
147 } else { | |
148 Expect.fail('unreachable'); | |
149 x = 111; | |
150 } | |
151 Expect.equals(99, y); | |
152 print(y); | |
153 } | |
154 Expect.equals(499, x); | |
155 print(x); | |
156 } | |
157 | |
158 void main() { | |
159 phi1(); | |
160 phi2(); | |
161 phi3(); | |
162 phi4(); | |
163 phi5(); | |
164 phi6(); | |
165 phi7(); | |
166 phi8(); | |
167 phi9(); | |
168 } | |
OLD | NEW |