Skip to content

Embind port #7239

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

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

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
work
  • Loading branch information
kripken committed Apr 2, 2024
commit 989a1b2aa407918bc8e81be965f12df7f924ed4a
22 changes: 15 additions & 7 deletions test/binaryen-embind.js/basics.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ function normEqual(x, y) {
const binaryenFactory = require(binaryen_js_path);

binaryenFactory().then((binaryen) => {
console.warn(binaryen.BasicType);
console.warn(binaryen.BasicType.i32);
console.warn(typeof binaryen.BasicType.i32);
assert.equal(binaryen.BasicType.i32, 2);

// Create a Module.
const module = new binaryen.Module();

Expand All @@ -34,8 +29,21 @@ binaryenFactory().then((binaryen) => {
const builder = new binaryen.Builder(module);

// Generate a function and everything we need for that.
const sig = new binaryen.Signature();
//const func = builder.makeFunction("foo",
const i32 = new binaryen.Type(binaryen.BasicType.i32);
const sig = {
params: i32,
results: i32
};
const func_ii = new binaryen.HeapType(sig);
const params = new binaryen.NameTypeVec();
params.push_back(new binaryen.NameType(new binaryen.Name("p0"), i32));
const vars = new binaryen.NameTypeVec();
const func = builder.makeFunction(
"foo",
params,
func_ii,
vars
);
console.log('success.');
});