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

Unified Diff: tests/language/issue9939_test.dart

Issue 13912013: Fix issue 9939 by making the body of a try block have two successors: the join block after the try/… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 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 | « sdk/lib/_internal/compiler/implementation/ssa/builder.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/issue9939_test.dart
===================================================================
--- tests/language/issue9939_test.dart (revision 0)
+++ tests/language/issue9939_test.dart (revision 0)
@@ -0,0 +1,43 @@
+// Copyright (c) 2013, 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 was generating incorrect code for the [A] constructor, by
+// using a temporary variable for two instructions, even though they
+// are both live at the same time.
+
+import "package:expect/expect.dart";
+
+var globalVar = [1, 2];
+
+class A {
+ final field1;
+ final field2;
+ var field3;
+
+ A(this.field1, this.field2) {
+ bool entered = false;
+ // We use [field1] twice to ensure it will have a temporary.
+ for (var a in field1) {
+ try {
+ entered = true;
+ // We use [field2] twice to ensure it will have a temporary.
+ print(field2);
+ print(field2);
+ } catch (e) {
+ // Because the catch is aborting, the SSA graph we used to
+ // generate thought that the whole try/catch was aborting, and
+ // therefore it could not reach the code after the loop.
+ throw e;
+ }
+ }
+ Expect.isTrue(entered);
+ // dart2js used to overwrite the temporary for [field1] with
+ // [field2].
+ Expect.equals(globalVar, field1);
+ }
+}
+
+main() {
+ new A(globalVar, null);
+}
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/builder.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698