@@ -115,6 +115,7 @@ urlPrefix: https://webassembly.github.io/spec/core/; spec: WebAssembly; type: df
115
115
text: global_read; url: appendix/embedding.html#embed-global-read
116
116
text: global_write; url: appendix/embedding.html#embed-global-write
117
117
text: ref_type; url: appendix/embedding.html#embed-ref-type
118
+ text: val_default; url: appendix/embedding.html#embed-val-default
118
119
text: match_valtype; url: appendix/embedding.html#embed-match-valtype
119
120
text: error; url: appendix/embedding.html#embed-error
120
121
text: store; url: exec/runtime.html#syntax-store
@@ -764,6 +765,7 @@ Each {{Table}} object has a \[[Table]] internal slot, which is a [=table address
764
765
1. If |maximum| is not empty and |maximum| < |initial|, throw a {{RangeError}} exception.
765
766
1. If |value| is missing,
766
767
1. Let |ref| be [=DefaultValue=] (|elementType|).
768
+ 1. Assert: |ref| is not [=error=] .
767
769
1. Otherwise,
768
770
1. Let |ref| be [=?=] [=ToWebAssemblyValue=] (|value|, |elementType|).
769
771
1. Let |type| be the [=table type=] {[=table type|min=] |initial|, [=table type|max=] |maximum|} |elementType|.
@@ -781,6 +783,7 @@ Each {{Table}} object has a \[[Table]] internal slot, which is a [=table address
781
783
1. Let (<var ignore> limits</var> , |elementType|) be [=table_type=] (|tableaddr|).
782
784
1. If |value| is missing,
783
785
1. Let |ref| be [=DefaultValue=] (|elementType|).
786
+ 1. If |ref| is [=error=] , throw a {{TypeError}} exception.
784
787
1. Otherwise,
785
788
1. Let |ref| be [=?=] [=ToWebAssemblyValue=] (|value|, |elementType|).
786
789
1. Let |result| be [=table_grow=] (|store|, |tableaddr|, |delta|, |ref|).
@@ -814,6 +817,7 @@ Each {{Table}} object has a \[[Table]] internal slot, which is a [=table address
814
817
1. Let (<var ignore> limits</var> , |elementType|) be [=table_type=] (|tableaddr|).
815
818
1. If |value| is missing,
816
819
1. Let |ref| be [=DefaultValue=] (|elementType|).
820
+ 1. If |ref| is [=error=] , throw a {{TypeError}} exception.
817
821
1. Otherwise,
818
822
1. Let |ref| be [=?=] [=ToWebAssemblyValue=] (|value|, |elementType|).
819
823
1. Let |store| be the [=surrounding agent=] 's [=associated store=] .
@@ -890,13 +894,8 @@ which can be simultaneously referenced by multiple {{Instance}} objects. Each
890
894
891
895
<div algorithm>
892
896
The algorithm <dfn>DefaultValue</dfn> (|valuetype|) performs the following steps:
893
- 1. If |valuetype| equals [=i32=] , return [=i32.const=] 0.
894
- 1. If |valuetype| equals [=i64=] , return [=i64.const=] 0.
895
- 1. If |valuetype| equals [=f32=] , return [=f32.const=] 0.
896
- 1. If |valuetype| equals [=f64=] , return [=f64.const=] 0.
897
- 1. If |valuetype| equals [=funcref=] , return [=ref.null=] [=funcref=] .
898
897
1. If |valuetype| equals [=externref=] , return [=ToWebAssemblyValue=] (undefined, |valuetype|).
899
- 1. Assert: This step is not reached .
898
+ 1. Return [=val_default=] (|valuetype|) .
900
899
</div>
901
900
902
901
<div algorithm>
@@ -907,6 +906,7 @@ which can be simultaneously referenced by multiple {{Instance}} objects. Each
907
906
1. Throw a {{TypeError}} exception.
908
907
1. If |v| is missing,
909
908
1. Let |value| be [=DefaultValue=] (|valuetype|).
909
+ 1. Assert: |value| is not [=error=] .
910
910
1. Otherwise,
911
911
1. Let |value| be [=ToWebAssemblyValue=] (|v|, |valuetype|).
912
912
1. If |mutable| is true, let |globaltype| be [=var=] |valuetype|; otherwise, let |globaltype| be [=const=] |valuetype|.
0 commit comments