diff options
author | Alon Zakai <alonzakai@gmail.com> | 2015-11-05 17:00:43 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2015-11-05 17:00:43 -0800 |
commit | be88a262864f1bb3fa0f36be20030546451a2735 (patch) | |
tree | 48007cab0fef80926edde1ec5b852ce9484067c4 /src/wasm-s-parser.h | |
parent | 2c7f50ed2663212f4fe9e0b2b6b9b7d4822add36 (diff) | |
download | binaryen-be88a262864f1bb3fa0f36be20030546451a2735.tar.gz binaryen-be88a262864f1bb3fa0f36be20030546451a2735.tar.bz2 binaryen-be88a262864f1bb3fa0f36be20030546451a2735.zip |
functions may have both params and a type
Diffstat (limited to 'src/wasm-s-parser.h')
-rw-r--r-- | src/wasm-s-parser.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/wasm-s-parser.h b/src/wasm-s-parser.h index ba58d61f1..c089de4a9 100644 --- a/src/wasm-s-parser.h +++ b/src/wasm-s-parser.h @@ -260,6 +260,7 @@ private: func->body = nullptr; localIndex = 0; labelIndex = 0; + std::vector<NameType> typeParams; // we may have both params and a type. store the type info here for (;i < s.size(); i++) { Element& curr = *s[i]; IString id = curr[0]->str(); @@ -283,7 +284,7 @@ private: for (size_t j = 0; j < type->params.size(); j++) { IString name = getName(j); WasmType currType = type->params[j]; - func->params.emplace_back(name, currType); + typeParams.emplace_back(name, currType); currLocalTypes[name] = currType; } } else { @@ -301,6 +302,9 @@ private: } } } + if (typeParams.size() > 0 && func->params.size() == 0) { + func->params = typeParams; + } if (!func->body) func->body = allocator.alloc<Nop>(); wasm.functions.push_back(func); currLocalTypes.clear(); |