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

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

Issue 2771453003: Format all tests. (Closed)
Patch Set: Format files Created 3 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 // Dart test program to test check that we don't fail to compile when an 5 // Dart test program to test check that we don't fail to compile when an
6 // inlinable method contains a throw. 6 // inlinable method contains a throw.
7 7
8 import 'package:expect/expect.dart'; 8 import 'package:expect/expect.dart';
9 9
10 var x = false; 10 var x = false;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 kast(x) { 46 kast(x) {
47 throw x; 47 throw x;
48 } 48 }
49 49
50 ternary(a, b, c) { 50 ternary(a, b, c) {
51 if (x == 2) throw "ternary"; 51 if (x == 2) throw "ternary";
52 } 52 }
53 53
54 hest() => kast("hest"); 54 hest() => kast("hest");
55 hest2() { return kast("hest2"); } 55 hest2() {
56 return kast("hest2");
57 }
58
56 foo() => true || kast("foo"); 59 foo() => true || kast("foo");
57 bar() => false || kast("foo"); 60 bar() => false || kast("foo");
58 barc() => callMeTrue() || kast("foo"); 61 barc() => callMeTrue() || kast("foo");
59 barCallThrow() => callMeFalse() || kast("foo"); 62 barCallThrow() => callMeFalse() || kast("foo");
60 baz(x) => x ? kast("baz") : 0; 63 baz(x) => x ? kast("baz") : 0;
61 bazc() => callMeFalse() ? kast("baz") : 0; 64 bazc() => callMeFalse() ? kast("baz") : 0;
62 bazCallThrow() => callMeTrue() ? kast("baz") : 0; 65 bazCallThrow() => callMeTrue() ? kast("baz") : 0;
63 fizz(x) => x ? 0 : kast("baz"); 66 fizz(x) => x ? 0 : kast("baz");
64 fizzc() => callMeTrue() ? 0 : kast("baz"); 67 fizzc() => callMeTrue() ? 0 : kast("baz");
65 fizzCallThrow() => callMeFalse() ? 0 : kast("baz"); 68 fizzCallThrow() => callMeFalse() ? 0 : kast("baz");
66 fuzz() => kast("baz") ? 0 : 1; 69 fuzz() => kast("baz") ? 0 : 1;
67 farce() => !kast("baz"); 70 farce() => !kast("baz");
68 unary() => ~(kast("baz")); 71 unary() => ~(kast("baz"));
69 boo() { 72 boo() {
70 callMe(); 73 callMe();
71 x = kast("boo"); 74 x = kast("boo");
72 } 75 }
76
73 yo() { 77 yo() {
74 throw kast("yo"); 78 throw kast("yo");
75 } 79 }
80
76 bin() { 81 bin() {
77 return 5 * kast("bin"); 82 return 5 * kast("bin");
78 } 83 }
84
79 binCallThrow() { 85 binCallThrow() {
80 return callMe() * kast("binct"); 86 return callMe() * kast("binct");
81 } 87 }
88
82 hoo() { 89 hoo() {
83 x[kast("hoo")] = 0; 90 x[kast("hoo")] = 0;
84 x[kast("hoo")]; 91 x[kast("hoo")];
85 kast("hoo").x = 0; 92 kast("hoo").x = 0;
86 kast("hoo").x; 93 kast("hoo").x;
87 } 94 }
88 95
89 switcheroo() { 96 switcheroo() {
90 switch (kast("switcheroo")) { 97 switch (kast("switcheroo")) {
91 case 0: 98 case 0:
92 boo(); 99 boo();
93 } 100 }
94 } 101 }
95 102
96 class ThrowConstructor { 103 class ThrowConstructor {
97 ThrowConstructor() : 104 ThrowConstructor()
98 foo = callMeTrue(), 105 : foo = callMeTrue(),
99 bar = kast("ThrowConstructor") { 106 bar = kast("ThrowConstructor") {
100 called = false; 107 called = false;
101 } 108 }
102 109
103 bool foo; 110 bool foo;
104 var bar; 111 var bar;
105 } 112 }
106 113
107 throwConstructor() { 114 throwConstructor() {
108 called = false; 115 called = false;
109 return new ThrowConstructor(); 116 return new ThrowConstructor();
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 print(x); 155 print(x);
149 } 156 }
150 157
151 dovileBreak() { 158 dovileBreak() {
152 var x = 0; 159 var x = 0;
153 do { 160 do {
154 callMe(); 161 callMe();
155 x = 1; 162 x = 1;
156 break; 163 break;
157 } while (kast("vile")); 164 } while (kast("vile"));
158 return(x); 165 return (x);
159 } 166 }
160 167
161 dovileContinue() { 168 dovileContinue() {
162 var x = 0; 169 var x = 0;
163 do { 170 do {
164 callMe(); 171 callMe();
165 x = 1; 172 x = 1;
166 continue; 173 continue;
167 } while (kast("vile")); 174 } while (kast("vile"));
168 return(x); 175 return (x);
169 } 176 }
170 177
171 dovileBreakContinue(x) { 178 dovileBreakContinue(x) {
172 do { 179 do {
173 callMe(); 180 callMe();
174 if (x == 1) break; 181 if (x == 1) break;
175 continue; 182 continue;
176 } while (kast("vile")); 183 } while (kast("vile"));
177 return(x); 184 return (x);
178 } 185 }
179 186
180 faar1() { 187 faar1() {
181 callMe(); 188 callMe();
182 for (kast("faar"); called = false; called = false) { 189 for (kast("faar"); called = false; called = false) {
183 called = false; 190 called = false;
184 } 191 }
185 } 192 }
186 193
187 faar2() { 194 faar2() {
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 testCallThenThrow(faar1); 294 testCallThenThrow(faar1);
288 testCallThenThrow(faar2); 295 testCallThenThrow(faar2);
289 testCallThenThrow(faar3); 296 testCallThenThrow(faar3);
290 testCallThenThrow(faar4); 297 testCallThenThrow(faar4);
291 testCallThenThrow(faar5); 298 testCallThenThrow(faar5);
292 testCallThenThrow(faar6); 299 testCallThenThrow(faar6);
293 testCallThenThrow(faar7); 300 testCallThenThrow(faar7);
294 testCallThenThrow(faar8); 301 testCallThenThrow(faar8);
295 testCall(faar9); 302 testCall(faar9);
296 } 303 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698