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

Side by Side Diff: frog/tests/leg_only/src/BreakTest.dart

Issue 9601009: Change labeled statement to use visitSubGraph for its body instead of marking its "exit block" spec… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comment. add more tests. Created 8 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 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 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 break1(int x, int y, int ew, int ez) { 5 break1(int x, int y, int ew, int ez) {
6 int w = 1; 6 int w = 1;
7 int z = 0; 7 int z = 0;
8 bk1: if (x == 2) { 8 bk1: if (x == 2) {
9 z = 1; 9 z = 1;
10 if (y == 3) { 10 if (y == 3) {
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 bar: break; 92 bar: break;
93 } else if (x == 4) { 93 } else if (x == 4) {
94 break bar; 94 break bar;
95 } else { 95 } else {
96 result = false; 96 result = false;
97 } 97 }
98 } while (false); 98 } while (false);
99 return result; 99 return result;
100 } 100 }
101 101
102 ifBreaks(x, y) {
103 int res = 2;
104 foo: if (x == 1) bar: {
105 if (y == 2) {
106 res = 4;
107 break foo;
108 } else if (y == 3) {
109 res = 5;
110 break bar;
111 }
112 res = 3;
113 } else baz: {
114 if (y == 2) {
115 res = 7;
116 break foo;
117 } else if (y == 3) {
118 res = 8;
119 break baz;
120 }
121 res = 6;
122 }
ngeoffray 2012/03/06 11:17:37 indentation is still off :)
Lasse Reichstein Nielsen 2012/03/08 09:02:02 That's actually deliberate, because I indent relat
123 return res;
124 }
125
102 main() { 126 main() {
103 break1(2, 3, 2, 1); 127 break1(2, 3, 2, 1);
104 break1(2, 4, 3, 1); 128 break1(2, 4, 3, 1);
105 break1(3, 3, 4, 2); 129 break1(3, 3, 4, 2);
106 break1(3, 4, 5, 2); 130 break1(3, 4, 5, 2);
107 break2(2, 3, 2, 1); 131 break2(2, 3, 2, 1);
108 break2(2, 4, 3, 1); 132 break2(2, 4, 3, 1);
109 break2(3, 3, 4, 2); 133 break2(3, 3, 4, 2);
110 break2(3, 4, 5, 2); 134 break2(3, 4, 5, 2);
111 break3(2, 3, 2, 1); 135 break3(2, 3, 2, 1);
112 break3(2, 4, 3, 1); 136 break3(2, 4, 3, 1);
113 break3(3, 3, 4, 2); 137 break3(3, 3, 4, 2);
114 break3(3, 4, 5, 2); 138 break3(3, 4, 5, 2);
115 Expect.isTrue(obscureBreaks(1), "1"); 139 Expect.isTrue(obscureBreaks(1), "1");
116 Expect.isTrue(obscureBreaks(2), "2"); 140 Expect.isTrue(obscureBreaks(2), "2");
117 Expect.isTrue(obscureBreaks(3), "3"); 141 Expect.isTrue(obscureBreaks(3), "3");
118 Expect.isTrue(obscureBreaks(4), "4"); 142 Expect.isTrue(obscureBreaks(4), "4");
119 Expect.isFalse(obscureBreaks(5), "5"); 143 Expect.isFalse(obscureBreaks(5), "5");
120 } 144 Expect.equals(3, ifBreaks(1, 4));
145 Expect.equals(4, ifBreaks(1, 2));
146 Expect.equals(5, ifBreaks(1, 3));
147 Expect.equals(6, ifBreaks(2, 4));
148 Expect.equals(7, ifBreaks(2, 2));
149 Expect.equals(8, ifBreaks(2, 3));
150 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698