blob: ada91c67ca48cd78dcbb2733d2c711fe20cf6405 [file] [log] [blame]
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001// Copyright 2015 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Flags: --harmony-destructuring-bind
6
7assertThrows(`for(const { method() {} } = this) {}`, SyntaxError);
8assertThrows(`var { method() {} } = this;`, SyntaxError);
9assertThrows(`for(const { *method() {} } = this) {}`, SyntaxError);
10assertThrows(`var { *method() {} } = this;`, SyntaxError);
11assertThrows(`for(var { get foo() {} } = this) {}`, SyntaxError);
12assertThrows(`for(var { set foo() {} } = this) {}`, SyntaxError);
13
14// Still OK in other objects
15for (var { name = "" + { toString() { return "test" } } } in { a: 1}) break;
16assertEquals(name, "test");