diff options
author | Alon Zakai <alonzakai@gmail.com> | 2018-09-19 15:50:30 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-19 15:50:30 -0700 |
commit | fe88b47749115009da0447e340cbdc86edf30984 (patch) | |
tree | 7dfd9aba7086c8aa6dff4877ac1ee3b9d78bc5ce /test/example/c-api-kitchen-sink.c | |
parent | a53356ab155a7d8c2f334dc9a3c1432bacbc78fe (diff) | |
download | binaryen-fe88b47749115009da0447e340cbdc86edf30984.tar.gz binaryen-fe88b47749115009da0447e340cbdc86edf30984.tar.bz2 binaryen-fe88b47749115009da0447e340cbdc86edf30984.zip |
Unify imported and non-imported things (#1678)
Fixes #1649
This moves us to a single object for functions, which can be imported or nor, and likewise for globals (as a result, GetGlobals do not need to check if the global is imported or not, etc.). All imported things now inherit from Importable, which has the module and base of the import, and if they are set then it is an import.
For convenient iteration, there are a few helpers like
ModuleUtils::iterDefinedGlobals(wasm, [&](Global* global) {
.. use global ..
});
as often iteration only cares about imported or defined (non-imported) things.
Diffstat (limited to 'test/example/c-api-kitchen-sink.c')
-rw-r--r-- | test/example/c-api-kitchen-sink.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c index 8248dea52..4e4944cda 100644 --- a/test/example/c-api-kitchen-sink.c +++ b/test/example/c-api-kitchen-sink.c @@ -202,7 +202,7 @@ void test_core() { BinaryenUnary(module, BinaryenEqZInt32(), // check the output type of the call node BinaryenUnary(module, BinaryenTruncSFloat32ToInt32(), - BinaryenCallImport(module, "an-imported", callOperands2, 2, BinaryenTypeFloat32()) + BinaryenCall(module, "an-imported", callOperands2, 2, BinaryenTypeFloat32()) ) ), BinaryenUnary(module, BinaryenEqZInt32(), // check the output type of the call node @@ -301,7 +301,7 @@ void test_unreachable() { BinaryenExpressionRef makeCallCheck(BinaryenModuleRef module, int x) { BinaryenExpressionRef callOperands[] = { makeInt32(module, x) }; - return BinaryenCallImport(module, "check", callOperands, 1, BinaryenTypeNone()); + return BinaryenCall(module, "check", callOperands, 1, BinaryenTypeNone()); } void test_relooper() { @@ -543,7 +543,7 @@ void test_interpret() { BinaryenFunctionTypeRef v = BinaryenAddFunctionType(module, "v", BinaryenTypeNone(), NULL, 0); BinaryenExpressionRef callOperands[] = { makeInt32(module, 1234) }; - BinaryenExpressionRef call = BinaryenCallImport(module, "print-i32", callOperands, 1, BinaryenTypeNone()); + BinaryenExpressionRef call = BinaryenCall(module, "print-i32", callOperands, 1, BinaryenTypeNone()); BinaryenFunctionRef starter = BinaryenAddFunction(module, "starter", v, NULL, 0, call); BinaryenSetStart(module, starter); |