Skip to content

Commit 0b8f557

Browse files
authored
Update index.bs
Tidy up punctuation.
1 parent 9209ee7 commit 0b8f557

File tree

1 file changed

+23
-20
lines changed

1 file changed

+23
-20
lines changed

document/js-api/index.bs

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,7 +1135,7 @@ This slot holds a [=function address=] relative to the [=surrounding agent=]'s [
11351135
1. Let |map| be the [=surrounding agent=]'s associated [=Exported Function cache=].
11361136
1. If |map|[|funcaddr|] [=map/exists=],
11371137
1. Return |map|[|funcaddr|].
1138-
1. Let |steps| be "[=call an Exported Function|call the Exported Function=] |funcaddr| with arguments."
1138+
1. Let |steps| be "[=call an Exported Function|call the Exported Function=] |funcaddr| with arguments.".
11391139
1. Let |realm| be the [=current Realm=].
11401140
1. Let |store| be the [=surrounding agent=]'s [=associated store=].
11411141
1. Let |functype| be [=func_type=](|store|, |funcaddr|).
@@ -1171,7 +1171,7 @@ This slot holds a [=function address=] relative to the [=surrounding agent=]'s [
11711171
1. Let (|store|, |ret|) be the result of [=func_invoke=](|store|, |funcaddr|, |args|).
11721172
1. Set the [=surrounding agent=]'s [=associated store=] to |store|.
11731173
1. If |ret| is [=error=], throw an exception. This exception should be a WebAssembly {{RuntimeError}} exception, unless otherwise indicated by <a href="#errors">the WebAssembly error mapping</a>.
1174-
1. If |ret| is [=THROW=] [=ref.exn=] |exnaddr|, then
1174+
1. If |ret| is [=THROW=] [=ref.exn=] |exnaddr|, then:
11751175
1. Let |tagaddr| be [=exn_tag=](|store|, |exnaddr|).
11761176
1. Let |payload| be [=exn_read=](|store|, |exnaddr|).
11771177
1. Let |jsTagAddr| be the result of [=get the JavaScript exception tag |getting the JavaScript exception tag=].
@@ -1200,7 +1200,7 @@ Note: Exported Functions do not have a \[[Construct]] method and thus it is not
12001200
1. Let |jsArguments| be « ».
12011201
1. [=list/iterate|For each=] |arg| of |arguments|,
12021202
1. [=list/Append=] [=!=] [=ToJSValue=](|arg|) to |jsArguments|.
1203-
1. Return |jsArguments|
1203+
1. Return |jsArguments|.
12041204
</div>
12051205

12061206
<div algorithm>
@@ -1242,7 +1242,7 @@ Note: Exported Functions do not have a \[[Construct]] method and thus it is not
12421242
1. [=Prepare to run script=] with |relevant settings|.
12431243
1. [=Prepare to run a callback=] with |stored settings|.
12441244
1. Let [|parameters|][|resultTypes|] be |functype|.
1245-
1. Let |jsArguments| be the result of [=coerce WebAssembly arguments=](|parameters|,|arguments|)
1245+
1. Let |jsArguments| be the result of [=coerce WebAssembly arguments=](|parameters|,|arguments|).
12461246
1. Let |result| be the result of Completion([$Call$](|func|, undefined, |jsArguments|)).
12471247
1. [=Clean up after running a callback=] with |stored settings|.
12481248
1. [=Clean up after running script=] with |relevant settings|.
@@ -1251,20 +1251,24 @@ Note: Exported Functions do not have a \[[Construct]] method and thus it is not
12511251
1. If |result|.\[[Type]] is <emu-const>normal</emu-const>, then:
12521252
1. Return the result of performing [=coerce a JavaScript return=] on |resultTypes| and |ret|.
12531253
1. If |result|.\[[Type]] is <emu-const>throw</emu-const>, then:
1254-
1. Let |v| be |result|.\[[Value]].
1255-
1. If |v| [=implements=] {{Exception}},
1256-
1. Let |address| be |v|.\[[Address]].
1257-
1. Otherwise,
1258-
1. Let |type| be the result of [=get the JavaScript exception tag |getting the JavaScript exception tag=].
1259-
1. Let |payload| be [=!=] [=ToWebAssemblyValue=](|v|, [=externref=]).
1260-
1. Let (|store|, |address|) be [=exn_alloc=](|store|, |type|, « |payload| »).
1261-
1. Set the [=surrounding agent=]'s [=associated store=] to |store|.
1262-
1. Execute the WebAssembly instructions ([=ref.exn=] |address|) ([=throw_ref=]).
1254+
1. Perform [=throw a JavaScript exception|throw the JavaScript exception=] |result|.\[[Value]].
12631255
1. Let (|store|, |funcaddr|) be [=func_alloc=](|store|, |functype|, |hostfunc|).
12641256
1. Set the [=surrounding agent=]'s [=associated store=] to |store|.
12651257
1. Return |funcaddr|.
12661258
</div>
12671259

1260+
<div algorithm>
1261+
To <dfn>throw a JavaScript exception</dfn> from the JavaScript object |v|, perform the following steps:
1262+
1. If |v| [=implements=] {{Exception}},
1263+
1. Let |address| be |v|.\[[Address]].
1264+
1. Otherwise,
1265+
1. Let |type| be the result of [=get the JavaScript exception tag |getting the JavaScript exception tag=].
1266+
1. Let |payload| be [=!=] [=ToWebAssemblyValue=](|v|, [=externref=]).
1267+
1. Let (|store|, |address|) be [=exn_alloc=](|store|, |type|, « |payload| »).
1268+
1. Set the [=surrounding agent=]'s [=associated store=] to |store|.
1269+
1. Execute the WebAssembly instructions ([=ref.exn=] |address|) ([=throw_ref=]).
1270+
</div>
1271+
12681272
<div algorithm>
12691273
The algorithm <dfn>ToJSValue</dfn>(|w|) coerces a [=WebAssembly value=] to a JavaScript value by performing the following steps:
12701274

@@ -1294,7 +1298,6 @@ The algorithm <dfn>ToJSValue</dfn>(|w|) coerces a [=WebAssembly value=] to a Jav
12941298
1. If |w| is of the form [=ref.host=] |hostaddr|, return the result of [=retrieving a host value=] from |hostaddr|.
12951299
1. If |w| is of the form [=ref.extern=] |ref|, return [=ToJSValue=](|ref|).
12961300

1297-
12981301
Note: Number values which are equal to NaN may have various observable NaN payloads; see [$NumericToRawBytes$] for details.
12991302
</div>
13001303

@@ -1327,7 +1330,7 @@ The algorithm <dfn>ToWebAssemblyValue</dfn>(|v|, |type|) coerces a JavaScript va
13271330
1. Let |n| be an implementation-defined integer such that [=canon=]<sub>32</sub> ≤ |n| < 2<sup>[=signif=](32)</sup>.
13281331
1. Let |f32| be [=nan=](n).
13291332
1. Otherwise,
1330-
1. Let |f32| be |number| rounded to the nearest representable value using IEEE 754-2008 round to nearest, ties to even mode. [[IEEE-754]]
1333+
\1.
13311334
1. Return [=f32.const=] |f32|.
13321335
1. If |type| is [=f64=],
13331336
1. Let |number| be [=?=] [$ToNumber$](|v|).
@@ -1427,7 +1430,7 @@ interface Suspending {
14271430
The algorithm to <dfn>evaluate a Promising function</dfn>(|promise|, |funcaddr|, |arguments|) consists of the following steps:
14281431
1. Let |store| be the [=surrounding agent=]'s [=associated store=].
14291432
1. Let |functype| be [=func_type=](|store|, |funcaddr|).
1430-
1. Let |args| be the result of [=coerce JavaScript arguments|coercing arguments=] (|functype|,|arguments|)
1433+
1. Let |args| be the result of [=coerce JavaScript arguments|coercing arguments=] (|functype|,|arguments|).
14311434
1. Let |map| be the [=surrounding agent=]'s associated [=Execution Context Status map=].
14321435
1. Let |ec| be the currently executing [=execution context=], i.e., the [=execution context=] that is at the top of the [=surrounding agent=]'s current [=execution context stack=].
14331436
1. Assert: |map| does not contain any entry for |ec|.
@@ -1439,8 +1442,8 @@ interface Suspending {
14391442
1. If |result| is [=error=], throw an exception. This exception must be a WebAssembly {{RuntimeError}} exception, unless otherwise indicated by <a href="#errors">the WebAssembly error mapping</a>.
14401443
1. Otherwise, if |result| is of the form [=throw=] exnaddr,
14411444
1. [=Reject=] |promise| with |result|.
1442-
1. Otherwise,
1443-
1. Assert: |result| is a [=list=] of WebAssembly values
1445+
1. Otherwise,
1446+
1. Assert: |result| is a [=list=] of WebAssembly values.
14441447
1. Let |outArity| be the [=list/size=] of |result|.
14451448
1. If |outArity| is 0, return undefined.
14461449
1. Otherwise, if |outArity| is 1, let |jsReturnValue| be [=ToJSValue=](|result|[0]).
@@ -1738,7 +1741,7 @@ constructor steps are:
17381741
1. If |resultType| is [=v128=] or [=exnref=],
17391742
1. Throw a {{TypeError}}.
17401743
1. [=list/Append=] [=?=] [=ToWebAssemblyValue=](|value|, |resultType|) to |wasmPayload|.
1741-
1. Let (|store|, |exceptionAddr|) be [=exn_alloc=](|store|, |exceptionTag|.\[[Address]], |wasmPayload|)
1744+
1. Let (|store|, |exceptionAddr|) be [=exn_alloc=](|store|, |exceptionTag|.\[[Address]], |wasmPayload|).
17421745
1. Set the [=surrounding agent=]'s [=associated store=] to |store|.
17431746
1. [=initialize an Exception object|Initialize=] **this** from |exceptionAddr|.
17441747
1. If |options|["traceStack"] is true,
@@ -1794,7 +1797,7 @@ first use and cached. It always has the [=tag type=] « [=externref=] » → «
17941797
To <dfn>get the JavaScript exception tag</dfn>, perform the following steps:
17951798

17961799
1. If the [=surrounding agent=]'s associated [=JavaScript exception tag=] has been initialized,
1797-
1. return the [=surrounding agent=]'s associated [=JavaScript exception tag=]
1800+
1. return the [=surrounding agent=]'s associated [=JavaScript exception tag=].
17981801
1. Let |store| be the [=surrounding agent=]'s [=associated store=].
17991802
1. Let (|store|, |tagAddress|) be [=tag_alloc=](|store|, « [=externref=] » → « »).
18001803
1. Set the current agent's [=associated store=] to |store|.

0 commit comments

Comments
 (0)