OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Flags: --strong-mode --allow-natives-syntax | 5 // Flags: --strong-mode --allow-natives-syntax |
6 // Flags: --harmony-arrow-functions --harmony-rest-parameters | 6 // Flags: --harmony-arrow-functions --harmony-rest-parameters |
7 // Flags: --harmony-destructuring --harmony-spread-arrays | 7 // Flags: --harmony-destructuring --harmony-spread-arrays |
8 | 8 |
9 'use strict'; | 9 'use strict'; |
10 | 10 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 assertWeakArray([1, 2, 3]); | 105 assertWeakArray([1, 2, 3]); |
106 assertWeakArray([1, 2, ...[3, 4], 5]); | 106 assertWeakArray([1, 2, ...[3, 4], 5]); |
107 assertWeakArray([[[]]]); | 107 assertWeakArray([[[]]]); |
108 assertWeakArray([[1], {}, [[3]]]); | 108 assertWeakArray([[1], {}, [[3]]]); |
109 assertWeakArray([[1], {}, [[3]]][0]); | 109 assertWeakArray([[1], {}, [[3]]][0]); |
110 assertWeakArray([[1], {}, [[3]]][2]); | 110 assertWeakArray([[1], {}, [[3]]][2]); |
111 assertWeakArray([[1], {}, [[3]]][2][0]); | 111 assertWeakArray([[1], {}, [[3]]][2][0]); |
112 assertWeakArray({a: [], b: {}}.a); | 112 assertWeakArray({a: [], b: {}}.a); |
113 })(); | 113 })(); |
114 | 114 |
115 (function StrongArrayLiterals(...args) { | 115 (function StrongArrayLiterals() { |
116 'use strong'; | 116 'use strong'; |
117 function assertStrongArray(x) { | 117 function assertStrongArray(x) { |
118 assertTrue(%IsStrong(x)); | 118 assertTrue(%IsStrong(x)); |
119 assertSame(Array.prototype, Object.getPrototypeOf(x)); | 119 assertSame(Array.prototype, Object.getPrototypeOf(x)); |
120 } | 120 } |
121 let [...r] = []; | 121 let [...r] = []; |
122 assertStrongArray(args); | 122 assertStrongArray((function(...a) { return a; })()); |
123 assertStrongArray(r); | 123 assertStrongArray(r); |
124 assertStrongArray([]); | 124 assertStrongArray([]); |
125 assertStrongArray([1, 2, 3]); | 125 assertStrongArray([1, 2, 3]); |
126 assertStrongArray([1, 2, ...[3, 4], 5]); | 126 assertStrongArray([1, 2, ...[3, 4], 5]); |
127 assertStrongArray([[[]]]); | 127 assertStrongArray([[[]]]); |
128 assertStrongArray([[1], {}, [[3]]]); | 128 assertStrongArray([[1], {}, [[3]]]); |
129 assertStrongArray([[1], {}, [[3]]][0]); | 129 assertStrongArray([[1], {}, [[3]]][0]); |
130 assertStrongArray([[1], {}, [[3]]][2]); | 130 assertStrongArray([[1], {}, [[3]]][2]); |
131 assertStrongArray([[1], {}, [[3]]][2][0]); | 131 assertStrongArray([[1], {}, [[3]]][2][0]); |
132 assertStrongArray({a: [], b: {}}.a); | 132 assertStrongArray({a: [], b: {}}.a); |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 })(); | 343 })(); |
344 | 344 |
345 (function StrongRegExpLiterals() { | 345 (function StrongRegExpLiterals() { |
346 'use strong'; | 346 'use strong'; |
347 function assertStrongRegExp(x) { | 347 function assertStrongRegExp(x) { |
348 // TODO(rossberg): strongify regexps | 348 // TODO(rossberg): strongify regexps |
349 // assertTrue(%IsStrong(x)); | 349 // assertTrue(%IsStrong(x)); |
350 } | 350 } |
351 assertStrongRegExp(/abc/); | 351 assertStrongRegExp(/abc/); |
352 })(); | 352 })(); |
OLD | NEW |