Skip to content
This repository was archived by the owner on Nov 3, 2021. It is now read-only.

Commit 27f6b02

Browse files
committed
fixup! [js-api] Extend the WebAssembly.Table API.
1 parent b2310ef commit 27f6b02

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

document/js-api/index.bs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -766,8 +766,10 @@ which can be simultaneously referenced by multiple {{Instance}} objects. Each
766766
1. let |initial| be |descriptor|["initial"].
767767
1. If |descriptor|["maximum"] is [=present=], let |maximum| be |descriptor|["maximum"]; otherwise, let |maximum| be empty.
768768
1. If |maximum| is not empty and |maximum| < |initial|, throw a {{RangeError}} exception.
769-
1. If |value| is missing, set |value| to [=DefaultValue=](|elementType|).
770-
1. Let |ref| be ? [=ToWebAssemblyValue=](|value|, |elementType|).
769+
1. If |value| is missing,
770+
1. Let |ref| be [=DefaultValue=](|elementType|).
771+
1. Otherwise,
772+
1. Let |ref| be ? [=ToWebAssemblyValue=](|value|, |elementType|).
771773
1. Let |type| be the [=table type=] {[=table type|𝗆𝗂𝗇=] |initial|, [=table type|𝗆𝖺𝗑=] |maximum|} |elementType|.
772774
1. Let |store| be the [=surrounding agent=]'s [=associated store=].
773775
1. Let (|store|, |tableaddr|) be [=table_alloc=](|store|, |type|, |ref|). <!-- TODO(littledan): Report allocation failure https://github.com/WebAssembly/spec/issues/584 -->
@@ -783,8 +785,10 @@ which can be simultaneously referenced by multiple {{Instance}} objects. Each
783785
1. Let |initialSize| be the length of **this**.\[[Values]].
784786
1. Let |store| be the [=surrounding agent=]'s [=associated store=].
785787
1. Let (<var ignore>limits</var>, |elementType|) be [=table_type=](|tableaddr|).
786-
1. If |value| is missing, set |value| to [=DefaultValue=](|elementType|).
787-
1. Let |ref| be ? [=ToWebAssemblyValue=](|value|, |elementType|).
788+
1. If |value| is missing,
789+
1. Let |ref| be [=DefaultValue=](|elementType|).
790+
1. Otherwise,
791+
1. Let |ref| be ? [=ToWebAssemblyValue=](|value|, |elementType|).
788792
1. Let |result| be [=table_grow=](|store|, |tableaddr|, |delta|, |ref|).
789793
1. If |result| is [=error=], throw a {{RangeError}} exception.
790794

@@ -812,8 +816,10 @@ which can be simultaneously referenced by multiple {{Instance}} objects. Each
812816
1. Let |tableaddr| be **this**.\[[Table]].
813817
1. Let |values| be **this**.\[[Values]].
814818
1. Let (<var ignore>limits</var>, |elementType|) be [=table_type=](|tableaddr|).
815-
1. If |value| is missing, set |value| to [=DefaultValue=](|elementType|).
816-
1. Let |ref| be ? [=ToWebAssemblyValue=](|value|, |elementType|).
819+
1. If |value| is missing,
820+
1. Let |ref| be [=DefaultValue=](|elementType|).
821+
1. Otherwise,
822+
1. Let |ref| be ? [=ToWebAssemblyValue=](|value|, |elementType|).
817823
1. Let |store| be the [=surrounding agent=]'s [=associated store=].
818824
1. Let |store| be [=table_write=](|store|, |tableaddr|, |index|, |ref|).
819825
1. If |store| is [=error=], throw a {{RangeError}} exception.

0 commit comments

Comments
 (0)