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

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

Issue 17491003: Fix a bug in graph construction for for loops. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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) 2011, the Dart project authors. Please see the AUTHORS file 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 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 // Dart test program for testing for statement. 4 // Dart test program for testing for statement.
5 5
6 import "package:expect/expect.dart"; 6 import "package:expect/expect.dart";
7 7
8 class Helper { 8 class Helper {
9 static int f1() { 9 static int f1() {
10 for (;;) return 1; 10 for (;;) return 1;
(...skipping 13 matching lines...) Expand all
24 24
25 static int f4(n) { 25 static int f4(n) {
26 int i = 0; 26 int i = 0;
27 for (bool stop = false; (i < n) && !stop; i++) { 27 for (bool stop = false; (i < n) && !stop; i++) {
28 if (i >= 5) { 28 if (i >= 5) {
29 stop = true; 29 stop = true;
30 } 30 }
31 } 31 }
32 return i; 32 return i;
33 } 33 }
34
35 static var status;
36 static void f5() {
37 status = 0;
38 for (var stop = false;;) {
39 if (stop) {
40 break;
41 } else {
42 stop = true;
43 continue;
44 }
45 }
filemon 2013/06/20 10:37:01 Does this test fail before patching? I mean, with
Kevin Millikin (Google) 2013/06/20 10:48:45 Yeah, it crashes without the fix. We should reall
filemon 2013/06/27 11:44:06 Hi, I wrote a simple script to generate loops: htt
46 status = 1;
47 }
34 } 48 }
35 49
36 class ForTest { 50 class ForTest {
37 static testMain() { 51 static testMain() {
38 Expect.equals(1, Helper.f1()); 52 Expect.equals(1, Helper.f1());
39 Expect.equals(0, Helper.f2(-1)); 53 Expect.equals(0, Helper.f2(-1));
40 Expect.equals(0, Helper.f2(0)); 54 Expect.equals(0, Helper.f2(0));
41 Expect.equals(10, Helper.f2(10)); 55 Expect.equals(10, Helper.f2(10));
42 Expect.equals(0, Helper.f3(-1)); 56 Expect.equals(0, Helper.f3(-1));
43 Expect.equals(0, Helper.f3(0)); 57 Expect.equals(0, Helper.f3(0));
44 Expect.equals(1, Helper.f3(1)); 58 Expect.equals(1, Helper.f3(1));
45 Expect.equals(3, Helper.f3(2)); 59 Expect.equals(3, Helper.f3(2));
46 Expect.equals(6, Helper.f3(3)); 60 Expect.equals(6, Helper.f3(3));
47 Expect.equals(10, Helper.f3(4)); 61 Expect.equals(10, Helper.f3(4));
48 Expect.equals(0, Helper.f4(-1)); 62 Expect.equals(0, Helper.f4(-1));
49 Expect.equals(0, Helper.f4(0)); 63 Expect.equals(0, Helper.f4(0));
50 Expect.equals(1, Helper.f4(1)); 64 Expect.equals(1, Helper.f4(1));
51 Expect.equals(6, Helper.f4(6)); 65 Expect.equals(6, Helper.f4(6));
52 Expect.equals(6, Helper.f4(10)); 66 Expect.equals(6, Helper.f4(10));
67
68 Helper.f5();
69 Expect.equals(1, Helper.status);
53 } 70 }
54 } 71 }
55 72
56 main() { 73 main() {
57 ForTest.testMain(); 74 ForTest.testMain();
58 } 75 }
OLDNEW
« runtime/vm/flow_graph_builder.cc ('K') | « runtime/vm/flow_graph_builder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698