1// Copyright JS Foundation and other contributors, http://js.foundation
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15try {
16  [...RegExp.$.$] = String();
17  assert(false);
18} catch (e) {
19  assert(e instanceof TypeError);
20}
21
22var o = { a : { b : { c : { d: { e : { } } } } } };
23
24[...o.a.b.c.d.e] = "foo";
25
26assert(o.a.b.c.d.e.length === 3);
27assert(o.a.b.c.d.e[0] === "f");
28assert(o.a.b.c.d.e[1] === "o");
29assert(o.a.b.c.d.e[2] === "o");
30
31[o.a.b.c.d.e] = "foo";
32
33assert(o.a.b.c.d.e === "f");
34
35[this.o.a.b.c.d.e] = "bar";
36assert(this.o.a.b.c.d.e === "b");
37
38[...this.o.a.b.c.d.e] = "bar";
39assert(this.o.a.b.c.d.e.length === 3);
40assert(this.o.a.b.c.d.e[0] === "b");
41assert(this.o.a.b.c.d.e[1] === "a");
42assert(this.o.a.b.c.d.e[2] === "r");
43