set-expand-contract.js (619B)
1 // Copyright (C) 2015 the V8 project authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 description: Set entry insertion and removal during traversal using for..of 6 info: | 7 New entries inserted into a Set instance during traversal should not be 8 visited if they are removed prior to visitation. 9 es6id: 13.6.4 10 features: [Set] 11 ---*/ 12 13 var set = new Set(); 14 var iterationCount = 0; 15 16 set.add(0); 17 18 for (var x of set) { 19 assert.sameValue(x, 0); 20 21 set.add(1); 22 set.delete(1); 23 24 iterationCount += 1; 25 } 26 27 assert.sameValue(iterationCount, 1); 28 29 reportCompare(0, 0);