From 9c9cd69470bde360f043da13a413da003c5649b5 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Wed, 28 Nov 2018 16:35:36 -0800 Subject: [PATCH] [spec] Remove fallback, per 2018.11.28 TC39 feedback Closes #39. --- index.html | 6 +++--- spec.emu | 6 ++---- spec.md | 7 +++---- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/index.html b/index.html index 8157754..7ef0817 100644 --- a/index.html +++ b/index.html @@ -45,7 +45,7 @@ "number": "3", "namespace": "", "location": "", - "referencingIds": ["_ref_10", "_ref_20"], + "referencingIds": ["_ref_20"], "key": "CreateRegExpStringIterator ( R, S, global, fullUnicode )" }, { "type": "clause", @@ -2203,7 +2203,7 @@
-

Stage 3 Draft / August 9, 2018

+

Stage 3 Draft / December 7, 2018

String.prototype.matchAll

@@ -2213,7 +2213,7 @@

1String.prototype.matchAll ( regexp )

Performs a regular expression match of the String representing the this value against regexp and returns an iterator. Each iteration result’s value is an Array object containing the results of the match, or null if the String did not match.

When the matchAll method is called, the following steps are taken:

-
  1. Let O be ? RequireObjectCoercible(this value).
  2. If regexp is neither undefined nor null, then
    1. Let matcher be ? GetMethod(regexp, @@matchAll).
    2. If matcher is not undefined, then
      1. Return ? Call(matcher, regexp, « O »).
  3. Let S be ? ToString(O).
  4. Let matcher be ? RegExpCreate(R, "g").
  5. Let global be true.
  6. Let fullUnicode be false.
  7. Return ! CreateRegExpStringIterator(matcher, S, global, fullUnicode). +
    1. Let O be ? RequireObjectCoercible(this value).
    2. If regexp is neither undefined nor null, then
      1. Let matcher be ? GetMethod(regexp, @@matchAll).
      2. If matcher is not undefined, then
        1. Return ? Call(matcher, regexp, « O »).
    3. Let S be ? ToString(O).
    4. Let rx be ? RegExpCreate(regexp, "g").
    5. Return ? Invoke(rx, @@matchAll, « S »).
    Note 1
    The matchAll function is intentionally generic, it does not require that its this value be a String object. Therefore, it can be transferred to other kinds of objects for use as a method.
    Note 2
    Similarly to String.prototype.split, String.prototype.matchAll is designed to typically act without mutating its inputs.
    diff --git a/spec.emu b/spec.emu index d88cefc..84c8b75 100644 --- a/spec.emu +++ b/spec.emu @@ -21,10 +21,8 @@ contributors: Jordan Harband 1. If _matcher_ is not *undefined*, then 1. Return ? Call(_matcher_, _regexp_, « _O_ »). 1. Let _S_ be ? ToString(_O_). - 1. Let _matcher_ be ? RegExpCreate(_R_, `"g"`). - 1. Let _global_ be *true*. - 1. Let _fullUnicode_ be *false*. - 1. Return ! CreateRegExpStringIterator(_matcher_, _S_, _global_, _fullUnicode_). + 1. Let _rx_ be ? RegExpCreate(_regexp_, `"g"`). + 1. Return ? Invoke(_rx_, @@matchAll, « _S_ »). The `matchAll` function is intentionally generic, it does not require that its *this* value be a String object. Therefore, it can be transferred to other kinds of objects for use as a method. Similarly to `String.prototype.split`, `String.prototype.matchAll` is designed to typically act without mutating its inputs. diff --git a/spec.md b/spec.md index 0f1e337..2a26f59 100644 --- a/spec.md +++ b/spec.md @@ -9,10 +9,8 @@ When the `matchAll` method is called, the following steps are taken: 1. If *matcher* is not **undefined**, then 1. Return ? [Call](call)(*matcher*, *regexp*, « *O* »). 1. Let *S* be ? [ToString][tostring](*O*). - 1. Let *matcher* be ? [RegExpCreate][regexp-create](*R*, `"g"`). - 1. Let *global* be **true**. - 1. Let *fullUnicode* be **false**. - 1. Return ! [CreateRegExpStringIterator](#createregexpstringiterator-abstract-operation)(*matcher*, *S*, *global*, *fullUnicode*). + 1. Let *rx* be ? [RegExpCreate][regexp-create](*regexp*, `"g"`). + 1. Return ? [Invoke][invoke](*rx*, @@matchAll, « *S* »). Note 1: The `matchAll` function is intentionally generic, it does not require that its *this* value be a String object. Therefore, it can be transferred to other kinds of objects for use as a method. Note 2: Similarly to `String.prototype.split`, `String.prototype.matchAll` is designed to typically act without mutating its inputs. @@ -171,3 +169,4 @@ This property has the attributes { [[Writable]]: **false**, [[Enumerable]]: **fa [tolength]: https://tc39.github.io/ecma262/#sec-tolength [set]: https://tc39.github.io/ecma262/#sec-set-o-p-v-throw [to-boolean]: https://tc39.github.io/ecma262/#sec-toboolean +[invoke]: https://tc39.github.io/ecma262/#sec-invoke