diff --git a/index.html b/index.html
index 4e1b0fd..5c39491 100644
--- a/index.html
+++ b/index.html
@@ -2164,8 +2164,13 @@
1String.prototype.matchAll ( regexp )
-
Throw a
- TypeError exception.
+ Let S be ?
+ ToString(O).
+ Let rx be ?
+ RegExpCreate(regexp,
+ undefined).
+ Return ?
+ Invoke(rx, @@matchAll, « S »).
@@ -2182,32 +2187,32 @@ 2RegExp.prototype [ @@matchAll ] ( string
Let rx be the
this value.
If
- Type(rx) is not Object, throw a
+ Type(rx) is not Object, throw a
TypeError exception.
Let S be ?
- ToString(string).
+ ToString(string).
Let C be ?
- SpeciesConstructor(rx,
+ SpeciesConstructor(rx,
%RegExp%).
Let flags be ?
- ToString(?
- Get(rx, "flags"
)).
+ ToString(?
+ Get(rx, "flags"
)).
If flags contains "g"
, let newFlags be flags.
Else, let newFlags be the string that is the concatenation of flags and "g"
.
Let matcher be ?
- Construct(C, « rx, newFlags »).
+ Construct(C, « rx, newFlags »).
Let lastIndex be
- ToLength(
- Get(rx,
+ ToLength(
+ Get(rx,
"lastIndex")).
- ReturnIfAbrupt(lastIndex).
+ ReturnIfAbrupt(lastIndex).
Let setStatus be
- Set(matcher,
+ Set(matcher,
"lastIndex", lastIndex,
true).
- ReturnIfAbrupt(setStatus).
+ ReturnIfAbrupt(setStatus).
Return CreateRegExpStringIterator(matcher, S)
@@ -2221,9 +2226,9 @@ 3CreateRegExpStringIterator ( regexp,
- Assert:
- Type(S) is String.
+ Type(S) is String.
- Let iterator be
- ObjectCreate(
+ ObjectCreate(
%RegExpStringIteratorPrototype%, «[[IteratingRegExp]], [[IteratedString]]»).
- Set iterator.[[IteratingRegExp]] to R.
- Set iterator.[[IteratedString]] to S.
@@ -2246,7 +2251,7 @@ 4.1%RegExpStringIteratorPrototype%.next ( )
- Let O be the
this value.
- If
- Type(O) is not Object, throw a
+ Type(O) is not Object, throw a
TypeError exception.
- If O does not have all of the internal slots of a RegExp String Iterator Object Instance (see
4.3), throw a
@@ -2254,12 +2259,12 @@
4.1%RegExpStringIteratorPrototype%.next ( )
- Let regexp be O.[[IteratingRegExp]].
- Let string be O.[[IteratedString]].
- Let match be
- RegExpExec(regexp, string)
+ RegExpExec(regexp, string)
- If match is
null, then
- Return
- CreateIterResultObject(
+ CreateIterResultObject(
null,
true).
@@ -2267,7 +2272,7 @@ 4.1%RegExpStringIteratorPrototype%.next ( )
- Otherwise,
- Return
- CreateIterResultObject(match,
+ CreateIterResultObject(match,
false).
@@ -2301,7 +2306,7 @@ 4.3Properties of RegExp String Iterator Instance
[[IteratingRegExp]] |
The regular expression used for iteration.
- IsRegExp([[IteratingRegExp]]) is always
+ IsRegExp([[IteratingRegExp]]) is always
true. |
diff --git a/spec.emu b/spec.emu
index 4256508..f895d54 100644
--- a/spec.emu
+++ b/spec.emu
@@ -12,7 +12,9 @@ contributors: Jordan Harband
1. Let _matcher_ be ? GetMethod(_regexp_, @@matchAll).
1. If _matcher_ is not *undefined*, then
1. Return ? Call(_matcher_, _regexp_, « _O_ »).
- 1. Throw a *TypeError* exception.
+ 1. Let _S_ be ? ToString(_O_).
+ 1. Let _rx_ be ? RegExpCreate(_regexp_, *undefined*).
+ 1. Return ? Invoke(_rx_, @@matchAll, « _S_ »).
Similarly to String.prototype.split, String.prototype.matchAll is designed to typically act without mutating its inputs.