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

Unified Diff: tests/language/nested_if_test.dart

Issue 10917012: Fix bad code-generation for nested-ifs in for loops. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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
« no previous file with comments | « lib/compiler/implementation/ssa/codegen_helpers.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/nested_if_test.dart
diff --git a/tests/language/nested_if_test.dart b/tests/language/nested_if_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..34b486afd54ece5f4b683c2e96ed0e744e8acbf2
--- /dev/null
+++ b/tests/language/nested_if_test.dart
@@ -0,0 +1,33 @@
+// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+// Dart2Js had problems with nested ifs inside loops.
+
+foo(x, a) {
+ /*---------------------------------------------*/
+ /*---------------------------------------------*/
+ /*---------------------------------------------*/
+ /*---------------------------------------------*/
+ /*---------------------------------------------*/
+ /*---------------------------------------------*/
+ /*------- Avoid inlining ----------------------*/
ngeoffray 2012/08/30 16:46:10 WebToolkitFramework? Maybe it's time to have a @No
floitsch 2012/08/30 16:51:35 I agree that we need that annotation. In a differe
+ /*---------------------------------------------*/
+ /*---------------------------------------------*/
+ /*---------------------------------------------*/
+ /*---------------------------------------------*/
+ /*---------------------------------------------*/
+ /*---------------------------------------------*/
+ for (int i = 0; i < 10; i++) {
+ if (x) {
+ if (!x) a = [];
+ a.add(3);
+ }
+ }
+ return a;
+}
+
+main() {
+ var a = foo(true, []);
+ Expect.equals(10, a.length);
+ Expect.equals(3, a[0]);
+}
« no previous file with comments | « lib/compiler/implementation/ssa/codegen_helpers.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698