Debian Codegraph @

js/src/tests/test262/language/statements/for-of/arguments-mapped-aliasing.js

raw
1 // Copyright (C) 2014 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 es6id: 13.6.4
5 description: >
6 Mapped arguments object mutation via alias during traversal using for..of
7 info: |
8 "Mapped" arguments objects should be able to be traversed using a `for..of`
9 loop, and dynamic changes to the formal parameters should be reflected in
10 the iterated values.
11 flags: [noStrict]
12 ---*/
13
14 var expected = [1, 3, 1];
15 var i = 0;
16
17 (function(a, b, c) {
18 for (var value of arguments) {
19 a = b;
20 b = c;
21 c = i;
22 assert.sameValue(value, expected[i], 'argument at index ' + i);
23 i++;
24 }
25
26 }(1, 2, 3));
27
28 assert.sameValue(i, 3, 'Visits all arguments');
29
30 reportCompare(0, 0);