Skip to content

Commit

Permalink
Normative: specify web reality for Array.prototype.join with cyclic v…
Browse files Browse the repository at this point in the history
…alues

Fixes tc39#289.
  • Loading branch information
ljharb committed Apr 26, 2019
1 parent 69d9e63 commit 7f2f524
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -5579,6 +5579,17 @@ <h1>Global Environment Records</h1>
Contains bindings for all declarations in global code for the associated realm code except for |FunctionDeclaration|, |GeneratorDeclaration|, |AsyncFunctionDeclaration|, |AsyncGeneratorDeclaration|, and |VariableDeclaration| _bindings_.
</td>
</tr>
<tr>
<td>
[[Seen]]
</td>
<td>
List of ECMAScript values
</td>
<td>
Exists as a realm-wide set of "seen" elements, to be used in, for example, Array.prototype.join
</td>
</tr>
<tr>
<td>
[[VarNames]]
Expand Down Expand Up @@ -32151,12 +32162,19 @@ <h1>Array.prototype.join ( _separator_ )</h1>
1. Else, let _sep_ be ? ToString(_separator_).
1. Let _R_ be the empty String.
1. Let _k_ be 0.
1. Let _realm_ be the current Realm Record.
1. Let _seen_ be _realm_.[[Seen]].
1. Repeat, while _k_ &lt; _len_
1. If _k_ &gt; 0, set _R_ to the string-concatenation of _R_ and _sep_.
1. Let _element_ be ? Get(_O_, ! ToString(_k_)).
1. If _element_ is *undefined* or *null*, let _next_ be the empty String; otherwise, let _next_ be ? ToString(_element_).
1. If _seen_ contains _element_, then
1. Let _next_ be the empty String.
1. Append _element_ to _seen_.
1. Else,
1. If _element_ is *undefined* or *null*, let _next_ be the empty String; otherwise, let _next_ be ? ToString(_element_).
1. Set _R_ to the string-concatenation of _R_ and _next_.
1. Increase _k_ by 1.
1. Set realm.[[Seen]] to a new empty List.
1. Return _R_.
</emu-alg>
<emu-note>
Expand Down

0 comments on commit 7f2f524

Please sign in to comment.