Skip to content
Open
Show file tree
Hide file tree
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
243 changes: 123 additions & 120 deletions src/js/binaryen.js-post.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/binaryen.js/atomics.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var wast = `
var module = binaryen.parseText(wast);

// i32/i64.atomic.load/store
module.addFunction("main", binaryen.none, binaryen.none, [], module.block("", [
module.addFunction("main", binaryen.Type.none, binaryen.Type.none, [], module.block("", [
// i32
module.i32.atomic.store(0,
module.i32.const(0),
Expand Down
4 changes: 2 additions & 2 deletions test/binaryen.js/copy-expression.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ var module = new binaryen.Module();
// Create an expression and copy it
var original = module.block(null, [
module.if(
module.local.get(0, binaryen.i32),
module.local.get(0, binaryen.Type.i32),
module.i32.const(1),
module.i32.const(2)
)
], binaryen.i32);
], binaryen.Type.i32);
var copy = module.copyExpression(original);

// Check that the expression incl. sub-expressions are copies
Expand Down
2 changes: 1 addition & 1 deletion test/binaryen.js/emit_asmjs.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var module = new binaryen.Module();

module.addFunction("main", binaryen.i32, binaryen.i32, [], module.local.get(0, binaryen.i32));
module.addFunction("main", binaryen.Type.i32, binaryen.Type.i32, [], module.local.get(0, binaryen.Type.i32));

module.addFunctionExport("main", "main");

Expand Down
6 changes: 3 additions & 3 deletions test/binaryen.js/exception-handling.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var module = new binaryen.Module();
module.setFeatures(binaryen.Features.ReferenceTypes |
binaryen.Features.ExceptionHandling);

module.addTag("e", binaryen.i32, binaryen.none);
module.addTag("e", binaryen.Type.i32, binaryen.Type.none);

// (try $l0
// (do
Expand All @@ -42,7 +42,7 @@ var try_catch = module.try(
module.drop(module.i32.pop()),
rethrow
],
binaryen.none
binaryen.Type.none
)
],
''
Expand Down Expand Up @@ -74,7 +74,7 @@ var try_delegate = module.try(
);

var body = module.block('', [try_catch, try_delegate])
var func = module.addFunction("test", binaryen.none, binaryen.none, [], body);
var func = module.addFunction("test", binaryen.Type.none, binaryen.Type.none, [], body);

console.log(module.emitText());
assert(module.validate());
Expand Down
34 changes: 17 additions & 17 deletions test/binaryen.js/expressionrunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function assertDeepEqual(x, y) {
}

var module = new binaryen.Module();
module.addGlobal("aGlobal", binaryen.i32, true, module.i32.const(0));
module.addGlobal("aGlobal", binaryen.Type.i32, true, module.i32.const(0));

// Should evaluate down to a constant
var runner = new binaryen.ExpressionRunner(module);
Expand All @@ -26,7 +26,7 @@ assertDeepEqual(
binaryen.getExpressionInfo(expr),
{
id: binaryen.ExpressionIds.Const,
type: binaryen.i32,
type: binaryen.Type.i32,
value: 3
}
);
Expand All @@ -47,7 +47,7 @@ assertDeepEqual(
binaryen.getExpressionInfo(expr),
{
id: binaryen.ExpressionIds.Const,
type: binaryen.i32,
type: binaryen.Type.i32,
value: 4
}
);
Expand All @@ -56,7 +56,7 @@ assertDeepEqual(
runner = new binaryen.ExpressionRunner(module);
expr = runner.runAndDispose(
module.i32.add(
module.local.get(0, binaryen.i32),
module.local.get(0, binaryen.Type.i32),
module.i32.const(1)
)
);
Expand All @@ -73,15 +73,15 @@ assert(expr === 0);
runner = new binaryen.ExpressionRunner(module);
expr = runner.runAndDispose(
module.i32.add(
module.local.tee(0, module.i32.const(4), binaryen.i32),
module.local.tee(0, module.i32.const(4), binaryen.Type.i32),
module.i32.const(1)
)
);
assertDeepEqual(
binaryen.getExpressionInfo(expr),
{
id: binaryen.ExpressionIds.Const,
type: binaryen.i32,
type: binaryen.Type.i32,
value: 5
}
);
Expand All @@ -90,7 +90,7 @@ assertDeepEqual(
runner = new binaryen.ExpressionRunner(module, Flags.PreserveSideeffects);
expr = runner.runAndDispose(
module.i32.add(
module.local.tee(0, module.i32.const(4), binaryen.i32),
module.local.tee(0, module.i32.const(4), binaryen.Type.i32),
module.i32.const(1)
)
);
Expand All @@ -102,19 +102,19 @@ expr = runner.runAndDispose(
module.i32.add(
module.block(null, [
module.local.set(0, module.i32.const(2)),
module.local.get(0, binaryen.i32)
], binaryen.i32),
module.local.get(0, binaryen.Type.i32)
], binaryen.Type.i32),
module.block(null, [
module.global.set("aGlobal", module.i32.const(4)),
module.global.get("aGlobal", binaryen.i32)
], binaryen.i32)
module.global.get("aGlobal", binaryen.Type.i32)
], binaryen.Type.i32)
)
);
assertDeepEqual(
binaryen.getExpressionInfo(expr),
{
id: binaryen.ExpressionIds.Const,
type: binaryen.i32,
type: binaryen.Type.i32,
value: 6
}
);
Expand All @@ -125,15 +125,15 @@ assert(runner.setLocalValue(0, module.i32.const(3)));
assert(runner.setGlobalValue("aGlobal", module.i32.const(4)));
expr = runner.runAndDispose(
module.i32.add(
module.local.get(0, binaryen.i32),
module.global.get("aGlobal", binaryen.i32)
module.local.get(0, binaryen.Type.i32),
module.global.get("aGlobal", binaryen.Type.i32)
)
);
assertDeepEqual(
binaryen.getExpressionInfo(expr),
{
id: binaryen.ExpressionIds.Const,
type: binaryen.i32,
type: binaryen.Type.i32,
value: 7
}
);
Expand All @@ -146,7 +146,7 @@ expr = runner.runAndDispose(
module.call("add", [
module.i32.const(3),
module.i32.const(4)
], binaryen.i32)
], binaryen.Type.i32)
)
);
assert(expr === 0);
Expand All @@ -156,7 +156,7 @@ runner = new binaryen.ExpressionRunner(module, Flags.Default, 1);
expr = runner.runAndDispose(
module.block(null, [
module.i32.const(1),
], binaryen.i32)
], binaryen.Type.i32)
);
assert(expr === 0);

Expand Down
Loading
Loading