Skip to content

Commit

Permalink
[js-api] Explicitly disallow creating Tables with non-reftypes. (WebA…
Browse files Browse the repository at this point in the history
  • Loading branch information
Ms2ger committed Jan 14, 2021
1 parent 7c7bd2a commit dd92422
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions document/js-api/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ urlPrefix: https://webassembly.github.io/reference-types/core/; spec: WebAssembl
text: f32
text: f64
url: syntax/types.html#syntax-reftype
text: reftype
text: funcref
text: externref
text: function element; url: exec/runtime.html#syntax-funcelem
Expand Down Expand Up @@ -765,6 +766,8 @@ Each {{Table}} object has a \[[Table]] internal slot, which is a [=table address
<div algorithm>
The <dfn constructor for="Table">Table(|descriptor|, |value|)</dfn> constructor, when invoked, performs the following steps:
1. Let |elementType| be [=ToValueType=](|descriptor|["element"]).
1. If |elementType| is not a [=reftype=],
1. [=Throw=] a {{TypeError}} exception.
1. Let |initial| be |descriptor|["initial"].
1. If |descriptor|["maximum"] [=map/exists=], let |maximum| be |descriptor|["maximum"]; otherwise, let |maximum| be empty.
1. If |maximum| is not empty and |maximum| &lt; |initial|, throw a {{RangeError}} exception.
Expand Down

0 comments on commit dd92422

Please sign in to comment.