Skip to content

Add WebAssembly.Function.bind override to the spec #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions document/js-api/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Prepare For TR: true
urlPrefix: https://tc39.github.io/ecma262/; spec: ECMASCRIPT
type: interface; for: ECMAScript
text: ArrayBuffer; url: sec-arraybuffer-objects
text: JSFunction; url: sec-function-objects
type: exception; for: ECMAScript
text: Error; url: sec-error-objects
text: NativeError; url: sec-nativeerror-constructors
Expand Down Expand Up @@ -93,6 +94,7 @@ urlPrefix: https://tc39.github.io/ecma262/; spec: ECMASCRIPT
text: IterableToList; url: sec-iterabletolist
text: ToBigInt64; url: #sec-tobigint64
text: BigInt; url: #sec-ecmascript-language-types-bigint-type
text: BoundFunctionCreate, url: #sec-boundfunctioncreate
type: abstract-op
text: CreateMethodProperty; url: sec-createmethodproperty
urlPrefix: https://webassembly.github.io/spec/core/; spec: WebAssembly; type: dfn
Expand Down Expand Up @@ -1106,8 +1108,6 @@ The <dfn method for="Global">type()</dfn> method steps are:
<h3 id="exported-functions">Exported Functions</h3>

<pre class="idl">
callback JSFunction = any (any... arguments);

dictionary FunctionType {
required sequence&lt;ValueType> parameters;
required sequence&lt;ValueType> results;
Expand All @@ -1118,6 +1118,7 @@ interface Function : JSFunction {
constructor(FunctionType descriptor, JSFunction callable);

FunctionType type();
JSFunction bind(any thisArg, any ...args);
};
</pre>

Expand Down Expand Up @@ -1318,6 +1319,17 @@ The <dfn method for="Function">type()</dfn> method steps are:

</div>

<div algorithm>

The <dfn method for="Function">bind(|thisArg|, ...|args|)</dfn> method steps are:

1. Let |Target| be the **this** value.
1. Let |F| be [$BoundFunctionCreate$](|Target|, |thisArg|, |args|).
1. Set |F|.\[[Prototype]] to {{JSFunction}}.prototype.
1. Return |F|.

</div>

<div algorithm>
To <dfn>construct a new WebAssembly Function</dfn> from a JavaScript [=callable=] object |callable| and {{FunctionType}} |signature|, perform the following steps:

Expand Down