Skip to content
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

typings: provide internal types for wasi bindings #54119

Merged
merged 2 commits into from
Aug 24, 2024

Conversation

RulerOfCakes
Copy link
Contributor

@RulerOfCakes RulerOfCakes commented Jul 30, 2024

Added internal types for WASI bindings from node_wasi.h and node_wasi.cpp, according to the present JS/CPP source code and the documentation.

Defined in:

node/src/node_wasi.cc

Lines 117 to 124 in 027710e

void WASI::New(const FunctionCallbackInfo<Value>& args) {
CHECK(args.IsConstructCall());
CHECK_EQ(args.Length(), 4);
CHECK(args[0]->IsArray());
CHECK(args[1]->IsArray());
CHECK(args[2]->IsArray());
CHECK(args[3]->IsArray());
Environment* env = Environment::GetCurrent(args);

node/src/node_wasi.cc

Lines 1254 to 1265 in 027710e

void WASI::_SetMemory(const FunctionCallbackInfo<Value>& args) {
WASI* wasi;
ASSIGN_OR_RETURN_UNWRAP(&wasi, args.This());
CHECK_EQ(args.Length(), 1);
if (!args[0]->IsWasmMemoryObject()) {
return node::THROW_ERR_INVALID_ARG_TYPE(
wasi->env(),
"\"instance.exports.memory\" property must be a WebAssembly.Memory "
"object");
}
wasi->memory_.Reset(wasi->env()->isolate(), args[0].As<WasmMemoryObject>());
}

Exported from:

node/src/node_wasi.cc

Lines 1328 to 1330 in 027710e

SetInstanceMethod(isolate, tmpl, "_setMemory", WASI::_SetMemory);
SetConstructorFunction(context, target, "WASI", tmpl);

@daeyeon daeyeon added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. labels Aug 14, 2024
@RedYetiDev RedYetiDev added the wasi Issues and PRs related to the WebAssembly System Interface. label Aug 14, 2024
@daeyeon daeyeon added the commit-queue Add this label to land a pull request using GitHub Actions. label Aug 24, 2024
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Aug 24, 2024
@nodejs-github-bot nodejs-github-bot merged commit c890a96 into nodejs:main Aug 24, 2024
30 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in c890a96

RafaelGSS pushed a commit that referenced this pull request Aug 25, 2024
@RafaelGSS RafaelGSS mentioned this pull request Aug 25, 2024
RafaelGSS pushed a commit that referenced this pull request Aug 30, 2024
@targos targos added the dont-land-on-v20.x PRs that should not land on the v20.x-staging branch and should not be released in v20.x. label Sep 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. dont-land-on-v20.x PRs that should not land on the v20.x-staging branch and should not be released in v20.x. typings wasi Issues and PRs related to the WebAssembly System Interface.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants