Skip to content

Commit

Permalink
[Refactor] update spec from tc39/ecma262#3306
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Apr 6, 2024
1 parent e8ba276 commit 1df378a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
3 changes: 1 addition & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
"GetIntrinsic",
"GetSetRecord",
"GetIteratorFromMethod",
"IteratorStep",
"IteratorValue",
"IteratorStepValue",
"SetDataHas",

// GetSetRecord
Expand Down
24 changes: 11 additions & 13 deletions implementation.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ var $Set = require('es-set/polyfill')();

var GetIteratorFromMethod = require('./aos/GetIteratorFromMethod');
var GetSetRecord = require('./aos/GetSetRecord');
var IteratorStep = require('es-abstract/2024/IteratorStep');
var IteratorValue = require('es-abstract/2024/IteratorValue');
var IteratorStepValue = require('es-abstract/2024/IteratorStepValue');

var isSet = require('is-set');

Expand All @@ -34,19 +33,18 @@ module.exports = function union(other) {
$setAdd(result, value);
});

var next = true; // step 6
while (next) { // step 7
next = IteratorStep(keysIter); // step 7.a
if (next) { // step 7.b
var nextValue = IteratorValue(next); // step 7.b.i
if (nextValue === 0) { // step 7.b.ii
nextValue = +0;
var next; // step 6
while (!keysIter['[[Done]]']) { // step 7
next = IteratorStepValue(keysIter); // step 7.a
if (!keysIter['[[Done]]']) { // step 7.b
if (next === 0) { // step 7.b.i
next = +0;
}

// if (!SetDataHas(resultSetData, nextValue)) { // step 7.b.iii
if (!$setHas(O, nextValue)) { // step 7.b.iii
// Append nextValue to resultSetData. // step 7.b.iii.1
$setAdd(result, nextValue);
// if (!SetDataHas(resultSetData, next)) { // step 7.b.ii
if (!$setHas(O, next)) { // step 7.b.ii
// Append next to resultSetData. // step 7.b.ii.1
$setAdd(result, next);
}
}
}
Expand Down

0 comments on commit 1df378a

Please sign in to comment.