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
Show file tree
Hide file tree
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
test.passes
  • Loading branch information
kripken committed Jan 24, 2025
commit 91e1029d3782abd62873e81878f521bfc064ff22
2 changes: 2 additions & 0 deletions src/binaryen-embind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ EMSCRIPTEN_BINDINGS(Binaryen) {
.value("f32", Type::BasicType::f32)
.value("f64", Type::BasicType::f64);

// TODO: make a "type factory" that produces types, so we can use
// value_object for Type?
class_<Type>("Type")
.constructor<Type::BasicType>()
.function("isTuple", &Type::isTuple)
Expand Down
5 changes: 3 additions & 2 deletions test/binaryen-embind.js/basics.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@ binaryenFactory().then((binaryen) => {

// Generate a function and everything we need for that.
const i32 = new binaryen.Type(binaryen.BasicType.i32);
const f64 = new binaryen.Type(binaryen.BasicType.f64);
const sig = {
params: i32,
results: i32
};
const func_ii = new binaryen.HeapType(sig);
const vars = new binaryen.TypeVec();
vars.push_back(binaryen.BasicType.f64);
vars.push_back(f64);
const func = binaryen.Builder.makeFunction(
new binaryen.Name("foo"),
func_ii,
Expand All @@ -51,7 +52,7 @@ binaryenFactory().then((binaryen) => {
(module
(type $0 (func (param i32) (result i32)))
(func $foo (param $0 i32) (result i32)
(local $temp f64)
(local $1 f64)
(nop)
)
)
Expand Down