diff --git a/index.html b/index.html index dea4135..9df3d16 100644 --- a/index.html +++ b/index.html @@ -2211,7 +2211,7 @@
-

Stage 3 Draft / February 27, 2018

+

Stage 3 Draft / March 5, 2018

String.prototype.matchAll

@@ -2267,7 +2267,7 @@

5The %RegExpStringIteratorPrototype% Object

5.1%RegExpStringIteratorPrototype%.next ( )

-
  1. Let O be the this value.
  2. If Type(O) is not Object, throw a TypeError exception.
  3. If O does not have all of the internal slots of a RegExp String Iterator Object Instance (see 5.3), throw a TypeError exception.
  4. If O.[[Done]] is true, then
    1. Return ! CreateIterResultObject(null, true).
  5. Let R be O.[[IteratingRegExp]].
  6. Let S be O.[[IteratedString]].
  7. Let global be O.[[Global]].
  8. Let fullUnicode be O.[[Unicode]].
  9. Let match be ? RegExpExec(R, S).
  10. If match is null, then
    1. Set O.[[Done]] to true.
    2. Return ! CreateIterResultObject(null, true).
  11. Else,
    1. If global is true,
      1. Let matchStr be ? ToString(? Get(match, "0")).
      2. If matchStr is the empty string,
        1. Let thisIndex be ? ToLength(? Get(R, "lastIndex")).
        2. Let nextIndex be ! AdvanceStringIndex(S, thisIndex, fullUnicode).
        3. Perform ? Set(R, "lastIndex", nextIndex, true).
      3. Return ! CreateIterResultObject(match, false).
    2. Else,
      1. Set O.[[Done]] to true.
      2. Return ! CreateIterResultObject(match, false). +
        1. Let O be the this value.
        2. If Type(O) is not Object, throw a TypeError exception.
        3. If O does not have all of the internal slots of a RegExp String Iterator Object Instance (see 5.3), throw a TypeError exception.
        4. If O.[[Done]] is true, then
          1. Return ! CreateIterResultObject(undefined, true).
        5. Let R be O.[[IteratingRegExp]].
        6. Let S be O.[[IteratedString]].
        7. Let global be O.[[Global]].
        8. Let fullUnicode be O.[[Unicode]].
        9. Let match be ? RegExpExec(R, S).
        10. If match is null, then
          1. Set O.[[Done]] to true.
          2. Return ! CreateIterResultObject(undefined, true).
        11. Else,
          1. If global is true,
            1. Let matchStr be ? ToString(? Get(match, "0")).
            2. If matchStr is the empty string,
              1. Let thisIndex be ? ToLength(? Get(R, "lastIndex")).
              2. Let nextIndex be ! AdvanceStringIndex(S, thisIndex, fullUnicode).
              3. Perform ? Set(R, "lastIndex", nextIndex, true).
            3. Return ! CreateIterResultObject(match, false).
          2. Else,
            1. Set O.[[Done]] to true.
            2. Return ! CreateIterResultObject(match, false).
        diff --git a/spec.emu b/spec.emu index 388f05c..d9db820 100644 --- a/spec.emu +++ b/spec.emu @@ -96,7 +96,7 @@ contributors: Jordan Harband 1. If Type(_O_) is not Object, throw a *TypeError* exception. 1. If _O_ does not have all of the internal slots of a RegExp String Iterator Object Instance (see ), throw a *TypeError* exception. 1. If _O_.[[Done]] is *true*, then - 1. Return ! CreateIterResultObject(*null*, *true*). + 1. Return ! CreateIterResultObject(*undefined*, *true*). 1. Let _R_ be _O_.[[IteratingRegExp]]. 1. Let _S_ be _O_.[[IteratedString]]. 1. Let _global_ be _O_.[[Global]]. @@ -104,7 +104,7 @@ contributors: Jordan Harband 1. Let _match_ be ? RegExpExec(_R_, _S_). 1. If _match_ is *null*, then 1. Set _O_.[[Done]] to *true*. - 1. Return ! CreateIterResultObject(*null*, *true*). + 1. Return ! CreateIterResultObject(*undefined*, *true*). 1. Else, 1. If _global_ is *true*, 1. Let _matchStr_ be ? ToString(? Get(_match_, *"0"*)). diff --git a/spec.md b/spec.md index 8263b7a..cbb714e 100644 --- a/spec.md +++ b/spec.md @@ -61,7 +61,7 @@ All RegExp String Iterator Objects inherit properties from the [%RegExpStringIte 1. If [Type][type](O) is not Object, throw a **TypeError** exception. 1. If O does not have all of the internal slots of a RegExp String Iterator Object Instance (see [here](#PropertiesOfRegExpStringIteratorInstances)), throw a **TypeError** exception. 1. If *O*.[[Done]] is **true**, then - 1. Return ! [CreateIterResultObject][create-iter-result-object](**null**, **true**). + 1. Return ! [CreateIterResultObject][create-iter-result-object](**undefined**, **true**). 1. Let *R* be *O*.[[IteratingRegExp]]. 1. Let *S* be *O*.[[IteratedString]]. 1. Let *global* be *O*.[[Global]]. @@ -69,7 +69,7 @@ All RegExp String Iterator Objects inherit properties from the [%RegExpStringIte 1. Let *match* be ? [RegExpExec][regexp-exec](*R*, *S*). 1. If *match* is **null**, then 1. Set *O*.[[Done]] to **true**. - 1. Return ! [CreateIterResultObject][create-iter-result-object](**null**, **true**). + 1. Return ! [CreateIterResultObject][create-iter-result-object](**undefined**, **true**). 1. Else, 1. If *global* is **true**, 1. Let *matchStr* be ? [ToString][to-string](? [Get][get](*match*, **"0"**)).