Skip to content

Commit 9570169

Browse files
committed
Tweak wording for trapping in builtins
1 parent d7765e6 commit 9570169

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

Diff for: document/js-api/index.bs

+11-11
Original file line numberDiff line numberDiff line change
@@ -1803,15 +1803,15 @@ To <dfn>validate an import for builtins</dfn> with |import|, enabled builtins |b
18031803

18041804
<h3 id="builtins-js-string">String Builtins</h3>
18051805

1806-
String builtins adapt the interface of the String builtin object. The import name for this set is `wasm:js-string`.
1806+
String builtins adapt the interface of the [=String=] builtin object. The import name for this set is `wasm:js-string`.
18071807

18081808
<h4 id="builtins-js-string-abstract-ops">Abstract operations</h4>
18091809
<div algorithm>
18101810

18111811
The <dfn abstract-op lt="UnwrapString">UnwrapString(|v|)</dfn> abstract operation, when invoked, performs the following steps:
18121812

18131813
1. If [=Type=](|v|) is not [=String=]
1814-
1. Throw a {{RuntimeError}} exception. TODO: this needs to not be catchable, like a trap.
1814+
1. Throw a {{RuntimeError}} exception as if a [=trap=] was executed.
18151815
1. Return |v|
18161816

18171817
</div>
@@ -1868,10 +1868,10 @@ Note: This function only takes a mutable i16 array defined in its own recursion
18681868
When this builtin is invoked with parameters |array|, |start|, and |end|, the following steps must be run:
18691869

18701870
1. If |array| is null
1871-
1. Throw a {{RuntimeError}} exception. TODO: this needs to not be catchable, like a trap.
1871+
1. Throw a {{RuntimeError}} exception as if a [=trap=] was executed.
18721872
1. Let |length| be the number of elements in |array|.
18731873
1. If |start| > |end| or |end| > |length|
1874-
1. Throw a {{RuntimeError}} exception. TODO: this needs to not be catchable, like a trap.
1874+
1. Throw a {{RuntimeError}} exception as if a [=trap=] was executed.
18751875
1. Let |result| be the empty string.
18761876
1. Let |i| be |start|.
18771877
1. While |i| < |end|:
@@ -1893,12 +1893,12 @@ Note: This function only takes a mutable i16 array defined in its own recursion
18931893
When this builtin is invoked with parameters |string|, |array|, and |start|, the following steps must be run:
18941894

18951895
1. If |array| is null
1896-
1. Throw a {{RuntimeError}} exception. TODO: this needs to not be catchable, like a trap.
1896+
1. Throw a {{RuntimeError}} exception as if a [=trap=] was executed.
18971897
1. Let |string| be [=?=] [$UnwrapString$](|string|).
18981898
1. Let |stringLength| be the [=string/length=] of |string|.
18991899
1. Let |arrayLength| be the number of elements in |array|.
19001900
1. If |start| + |stringLength| > |arrayLength|
1901-
1. Throw a {{RuntimeError}} exception. TODO: this needs to not be catchable, like a trap.
1901+
1. Throw a {{RuntimeError}} exception as if a [=trap=] was executed.
19021902
1. Let |i| be 0.
19031903
1. While |i| < |stringLength|:
19041904
1. Let |charCode| be [$CharCodeAt$](|string|, |i|).
@@ -1928,7 +1928,7 @@ The |funcType| of this builtin is `(func (param i32) (result externref))`.
19281928
When this builtin is invoked with parameter |v|, the following steps must be run:
19291929

19301930
1. If |v| &gt; 0x10ffff
1931-
1. Throw a {{RuntimeError}} exception. TODO: this needs to not be catchable, like a trap.
1931+
1. Throw a {{RuntimeError}} exception as if a [=trap=] was executed.
19321932
1. Return [=!=] [$Call$]([=String.fromCodePoint=], undefined, « [=ToJSValue=](|v|) »).
19331933

19341934
</div>
@@ -1943,7 +1943,7 @@ When this builtin is invoked with parameters |string| and |index|, the following
19431943
1. Let |string| be [=?=] [$UnwrapString$](|string|).
19441944
1. Let |length| be the [=string/length=] of |string|.
19451945
1. If |index| >= |length|
1946-
1. Throw a {{RuntimeError}} exception. TODO: this needs to not be catchable, like a trap.
1946+
1. Throw a {{RuntimeError}} exception as if a [=trap=] was executed.
19471947
1. Return [$CharCodeAt$](|string|, |index|).
19481948

19491949
</div>
@@ -1958,7 +1958,7 @@ When this builtin is invoked with parameters |string| and |index|, the following
19581958
1. Let |string| be [=?=] [$UnwrapString$](|string|).
19591959
1. Let |length| be the [=string/length=] of |string|.
19601960
1. If |index| >= |length|
1961-
1. Throw a {{RuntimeError}} exception. TODO: this needs to not be catchable, like a trap.
1961+
1. Throw a {{RuntimeError}} exception as if a [=trap=] was executed.
19621962
1. Return [=!=] [$Call$]([=String.prototype.codePointAt=], |string|, « [=ToJSValue=](|index|) »).
19631963

19641964
</div>
@@ -2014,9 +2014,9 @@ Note: Explicitly allow null strings to be compared for equality as that is meani
20142014
When this builtin is invoked with parameters |first| and |second|, the following steps must be run:
20152015

20162016
1. If |first| is not null and [=Type=](|first|) is not [=String=]
2017-
1. Throw a {{RuntimeError}} exception. TODO: this needs to not be catchable, like a trap.
2017+
1. Throw a {{RuntimeError}} exception as if a [=trap=] was executed.
20182018
1. If |second| is not null and [=Type=](|second|) is not [=String=]
2019-
1. Throw a {{RuntimeError}} exception. TODO: this needs to not be catchable, like a trap.
2019+
1. Throw a {{RuntimeError}} exception as if a [=trap=] was executed.
20202020
1. If [=!=] [=IsStrictlyEqual=](|first|, |second|) is true
20212021
1. Return 1.
20222022
1. Return 0.

0 commit comments

Comments
 (0)