@@ -1814,6 +1814,15 @@ The <dfn abstract-op lt="UnwrapString">UnwrapString(|v|)</dfn> abstract operatio
1814
1814
1815
1815
</div>
1816
1816
1817
+ <div algorithm>
1818
+
1819
+ The <dfn abstract-op lt="FromCharCode">FromCharCode(|v|)</dfn> abstract operation, when invoked, performs the following steps:
1820
+
1821
+ 1. Assert: |v| is of type [=i32=] .
1822
+ 1. Return [=!=] [$Call$] ([=String.fromCharCode=] , undefined, « [=ToJSValue=] (|v|) »).
1823
+
1824
+ </div>
1825
+
1817
1826
<h4 id="js-string-cast">cast</h4>
1818
1827
1819
1828
The |funcType| of this builtin is `(func (param externref) (result externref))`.
@@ -1840,7 +1849,25 @@ When this builtin is invoked with parameter |v|, the following steps must be run
1840
1849
1841
1850
<h4 id="js-string-fromCharCodeArray">fromCharCodeArray</h4>
1842
1851
1843
- TODO
1852
+ The |funcType| of this builtin is `(func (param (ref null (array (mut i16))) i32 i32) (result externref))`.
1853
+
1854
+ <div algorithm="js-string-fromCharCodeArray">
1855
+ When this builtin is invoked with parameters |array|, |start|, and |end|, the following steps must be run:
1856
+
1857
+ 1. If |array| is nul]
1858
+ 1. Throw a {{RuntimeError}} exception. TODO: this needs to not be catchable, like a trap.
1859
+ 1. If |start| > |end| or |end| > [=array_len=] (|array|)
1860
+ 1. Throw a {{RuntimeError}} exception. TODO: this needs to not be catchable, like a trap.
1861
+ 1. Let |result| be the empty string
1862
+ 1. Let |i| be |start|
1863
+ 1. While |i| < |end|:
1864
+ 1. Let |charCode| be [=array_i16_get=] (|array|, |i|).
1865
+ 1. Let |charCodeString| be [$FromCharCode$] (|charCode|).
1866
+ 1. Let |result| be the concatenation of |result| and |charCodeString|.
1867
+ 1. Set |i| to |i| + 1.
1868
+ 1. Return |result|
1869
+
1870
+ </div>
1844
1871
1845
1872
<h4 id="js-string-intoCharCodeArray">intoCharCodeArray</h4>
1846
1873
@@ -1853,7 +1880,7 @@ The |funcType| of this builtin is `(func (param i32) (result externref))`.
1853
1880
<div algorithm="js-string-fromCharCode">
1854
1881
When this builtin is invoked with parameter |v|, the following steps must be run:
1855
1882
1856
- 1. Return [=!=] [$Call $] ([=String.fromCharCode=] , undefined, « [=ToJSValue=] ( |v|) » ).
1883
+ 1. Return [$FromCharCode $] (|v|).
1857
1884
1858
1885
</div>
1859
1886
0 commit comments