diff options
author | Alon Zakai <alonzakai@gmail.com> | 2015-11-05 16:47:41 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2015-11-05 16:47:41 -0800 |
commit | 9b8cbda9322b4aec1c86460396fcb472c768843b (patch) | |
tree | 3807142bb0cfa489b0806d51b19d37f545a5c598 /src/wasm-s-parser.h | |
parent | a8a78dd5e6f83263085cb3e4dea21c0f10a60b4f (diff) | |
download | binaryen-9b8cbda9322b4aec1c86460396fcb472c768843b.tar.gz binaryen-9b8cbda9322b4aec1c86460396fcb472c768843b.tar.bz2 binaryen-9b8cbda9322b4aec1c86460396fcb472c768843b.zip |
allow accessing module elements by index name
Diffstat (limited to 'src/wasm-s-parser.h')
-rw-r--r-- | src/wasm-s-parser.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/wasm-s-parser.h b/src/wasm-s-parser.h index 761a751ac..85c60a3fc 100644 --- a/src/wasm-s-parser.h +++ b/src/wasm-s-parser.h @@ -826,10 +826,15 @@ private: im->module = s[2]->str(); im->base = s[3]->str(); Element& params = *s[4]; - if (params[0]->str() == PARAM) { + IString id = params[0]->str(); + if (id == PARAM) { for (size_t i = 1; i < params.size(); i++) { im->type.params.push_back(stringToWasmType(params[i]->str())); } + } else if (id == TYPE) { + IString name = params[1]->str(); + assert(wasm.functionTypesMap.find(name) != wasm.functionTypesMap.end()); + im->type = *wasm.functionTypesMap[name]; } else { onError(); } |