Skip to content
This repository has been archived by the owner on Aug 17, 2022. It is now read-only.

Commit

Permalink
Merge pull request #26 from WebAssembly/alloc-func-name
Browse files Browse the repository at this point in the history
Specify allocation function by name instead of index
  • Loading branch information
jgravelle-google committed Apr 18, 2019
2 parents 8891872 + 95c8510 commit 3829f51
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions proposals/webidl-bindings/Explainer.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ tuple** of WebAssembly values. A sample list of incoming binding operators:
| :--- | :--- | :--- | :--- |
| **get** | idx | | Return the `idx`th Web IDL value of the source tuple. |
| **as** | wasm‑type | *in‑expr* | Take the result of `in-expr`, which can be any Web IDL value, and produces a wasm value of `wasm-type`, allowing only trivial conversions (like [`long`] to `i32` or [`any`] to `anyref`). |
| **alloc‑utf8‑str** | alloc‑func‑idx | *in‑expr* | Take the result of `in-expr`, which must be either [`DOMString`] or [`USVString`], compute the number of bytes necessary to store a UTF-8 encoding of this string, call the `alloc-func-idx`'th function of the receiving instance, passing the number of bytes and using the resulting offset to store the UTF-8 encoding, as specified by [`TextEncoder`], finally returning the offset and byte-length as two `i32`s (and trapping on OOM). |
| **alloc‑copy** | alloc‑func‑idx | *in‑expr* | Take the result of `in-expr`, which must be a [`BufferSource`] or [`ByteString`], call the `alloc-func-idx`'th function of the receiving instance, passing the length and using the resulting offset to store a copy of the bytes into linear memory, returning the offset and byte-length as two `i32`s (and trapping on OOM). |
| **alloc‑utf8‑str** | alloc‑func‑name | *in‑expr* | Take the result of `in-expr`, which must be either [`DOMString`] or [`USVString`], compute the number of bytes necessary to store a UTF-8 encoding of this string, call the function exported by name `alloc-func-name` from the receiving instance, passing the number of bytes and using the resulting offset to store the UTF-8 encoding, as specified by [`TextEncoder`], finally returning the offset and byte-length as two `i32`s (and trapping on OOM). |
| **alloc‑copy** | alloc‑func‑name | *in‑expr* | Take the result of `in-expr`, which must be a [`BufferSource`] or [`ByteString`], call the function exported by name `alloc-func-name` from the receiving instance, passing the length and using the resulting offset to store a copy of the bytes into linear memory, returning the offset and byte-length as two `i32`s (and trapping on OOM). |
| **enum‑to‑i32** | webidl‑type | *in‑expr* | Take the result of `in-expr`, which must be an [Enumeration] value, and reverse-map this string to the `i32` index of the matching string in the `webidl-type`, which must also be an Enumeration. |
| **field** | field‑idx | *in‑expr* | Take the result of `in-expr`, which must be a [Dictionary] value, and return the Web IDL value of the `field-idx`'th field. |
| **bind‑import** | wasm‑type<br>binding | *in‑expr* | Take the result of `in-expr`, which must be a [Callback] value, and apply `binding` to produce a [`funcref`] (or, later, a typed function reference). (See [`BindImport`](#instantiation-and-runtime) below.) |
Expand Down

0 comments on commit 3829f51

Please sign in to comment.