Chromium Code Reviews

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

Issue 1488043002: [parser] treat MethodDefinitions in ObjectPatterns as SyntaxErrors (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « src/parsing/preparser.h ('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-4585.js
diff --git a/test/mjsunit/harmony/regress/regress-4585.js b/test/mjsunit/harmony/regress/regress-4585.js
new file mode 100644
index 0000000000000000000000000000000000000000..bf26948cdf90668bace9c1e587245a3f5d8af6e7
--- /dev/null
+++ b/test/mjsunit/harmony/regress/regress-4585.js
@@ -0,0 +1,13 @@
+// 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-destructuring-bind
+
+assertThrows(`for(const { function(){} } = this) {}`, SyntaxError);
adamk 2015/12/01 18:27:57 Can you put these tests in test-parsing instead? T
+assertThrows(`var { function() {} } = this;`, SyntaxError);
adamk 2015/12/01 18:27:57 Also can you use 'method' instead of 'function'? I
+assertThrows(`for(var { get foo() {} } = this) {}`, SyntaxError);
adamk 2015/12/01 18:27:57 Also add a test for 'set foo(arg)'
+
+// Still OK in other objects
+for (var { name = "" + { toString() { return "test" } } } in { a: 1}) break;
+assertEquals(name, "test");
« no previous file with comments | « src/parsing/preparser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine