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

Unified Diff: test/mjsunit/harmony/regress/regress-4658.js

Issue 1564343002: Fix for temporaries in parameter initializers (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 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 | « src/parsing/parameter-initializer-rewriter.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/regress/regress-4658.js
diff --git a/test/mjsunit/harmony/regress/regress-4658.js b/test/mjsunit/harmony/regress/regress-4658.js
new file mode 100644
index 0000000000000000000000000000000000000000..35bea12adcf74a81a3b252813aed8d7e441b8bbc
--- /dev/null
+++ b/test/mjsunit/harmony/regress/regress-4658.js
@@ -0,0 +1,21 @@
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --harmony-do-expressions
+
+(function testWithSimpleLoopVariable() {
+ var f = (x, y = (do { var s=0; for (var e of x) s += e; s; })) => y*(y+1);
+ var result = f([1,2,3]); // core dump here, if not fixed.
+ assertEquals(result, 42);
+})();
+
+(function testWithComplexLoopVariable() {
+ var f = (x, i=x[0]-1, a=[],
+ y = (do { var s=0;
+ for (a[i] of x) s += a[i++];
+ s;
+ })) => y*(a[0]+a[1]*a[2]);
+ var result = f([1,2,3]); // core dump here, if not fixed.
+ assertEquals(result, 42);
+})();
« no previous file with comments | « src/parsing/parameter-initializer-rewriter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698