diff options
author | Daniel Wirtz <dcode@dcode.io> | 2020-08-20 01:36:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-19 16:36:17 -0700 |
commit | a18d30fb42838f2e4002338d6e57a25322f9e422 (patch) | |
tree | 930607d9202d35eaf66d784df29162400efd98cb /src/tools/wasm2c-wrapper.h | |
parent | b43807a835fc878e5eefcb8b4a18aff62d7f4540 (diff) | |
download | binaryen-a18d30fb42838f2e4002338d6e57a25322f9e422.tar.gz binaryen-a18d30fb42838f2e4002338d6e57a25322f9e422.tar.bz2 binaryen-a18d30fb42838f2e4002338d6e57a25322f9e422.zip |
Replace Type::expand() with an iterator-based approach (#3061)
This leads to simpler code and is a prerequisite for #3012, which makes it so that not all `Type`s are backed by vectors that `expand` could return.
Diffstat (limited to 'src/tools/wasm2c-wrapper.h')
-rw-r--r-- | src/tools/wasm2c-wrapper.h | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/tools/wasm2c-wrapper.h b/src/tools/wasm2c-wrapper.h index eae92ad60..0dd3c4381 100644 --- a/src/tools/wasm2c-wrapper.h +++ b/src/tools/wasm2c-wrapper.h @@ -144,7 +144,6 @@ int main(int argc, char** argv) { // Emit the callee's name with wasm2c name mangling. ret += std::string("(*Z_") + exp->name.str + "Z_"; - auto params = func->sig.params.expand(); auto wasm2cSignature = [](Type type) { TODO_SINGLE_COMPOUND(type); @@ -165,18 +164,18 @@ int main(int argc, char** argv) { }; ret += wasm2cSignature(result); - if (params.empty()) { - ret += wasm2cSignature(Type::none); - } else { - for (auto param : params) { + if (func->sig.params.isMulti()) { + for (auto& param : func->sig.params) { ret += wasm2cSignature(param); } + } else { + ret += wasm2cSignature(func->sig.params); } ret += ")("; // Emit the parameters (all 0s, like the other wrappers). bool first = true; - for (auto param : params) { + for (auto& param : func->sig.params) { WASM_UNUSED(param); if (!first) { ret += ", "; |