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

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

Issue 318723002: dart2dart: Restore loops with conditions and updates in backend. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Test cases Created 6 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
(Empty)
1 // Copyright (c) 2014, 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 var baz_clicks = 0;
8
9 baz() {
10 return ++baz_clicks;
11 }
12
13 var global = 0;
14
15 increment_global() {
16 ++global;
17 return global <= 10;
18 }
19
20 foo(x, y) {
21 var n = 0;
22 while (true) {
23 baz();
24 if (n >= x) {
25 return n;
26 }
27 baz();
28 if (n >= y) {
29 return n;
30 }
31 n = n + 1;
32 }
33 }
34
35 bar() {
36 while (increment_global()) {
37 baz();
38 }
39 return baz();
40 }
41
42 main() {
43 Expect.equals(10, foo(10, 20));
44 Expect.equals(10, foo(20, 10));
45
46 baz_clicks = 0;
47 Expect.equals(11, bar());
48 }
OLDNEW
« no previous file with comments | « tests/language/rewrite_for_update_order_test.dart ('k') | tests/language/rewrite_while_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698