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

Unified Diff: tests/language/rewrite_for_update_order.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: Kevin's comments + bugfix 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 side-by-side diff with in-line comments
Download patch
Index: tests/language/rewrite_for_update_order.dart
diff --git a/tests/language/rewrite_if_swap_test.dart b/tests/language/rewrite_for_update_order.dart
similarity index 50%
copy from tests/language/rewrite_if_swap_test.dart
copy to tests/language/rewrite_for_update_order.dart
index 0b515bf952e34a479a3a38611c2d93037ff6df2f..80ed9de9182175758cbd840b28fa025326b9876b 100644
--- a/tests/language/rewrite_if_swap_test.dart
+++ b/tests/language/rewrite_for_update_order.dart
@@ -4,30 +4,29 @@
import "package:expect/expect.dart";
+var counter = 0;
var global = 0;
-bar() {
- global += 1;
+test() {
+ ++counter;
+ return counter <= 2;
}
-baz() {
- global += 100;
+
+first() {
+ global = global + 1;
+}
+second() {
+ global = global * 2;
}
-foo(b) {
- var old_backend_was_used;
- if (b ? false : true) {
- bar();
- bar();
- } else {
- baz();
- baz();
+foo() {
+ while (test()) {
+ first();
+ second();
}
}
main() {
- foo(true);
- Expect.equals(200, global);
-
- foo(false);
- Expect.equals(202, global);
+ foo();
+ Expect.equals(6, global);
}

Powered by Google App Engine
This is Rietveld 408576698