summaryrefslogtreecommitdiff
path: root/src/wasm-s-parser.h
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2015-11-05 16:47:41 -0800
committerAlon Zakai <alonzakai@gmail.com>2015-11-05 16:47:41 -0800
commit9b8cbda9322b4aec1c86460396fcb472c768843b (patch)
tree3807142bb0cfa489b0806d51b19d37f545a5c598 /src/wasm-s-parser.h
parenta8a78dd5e6f83263085cb3e4dea21c0f10a60b4f (diff)
downloadbinaryen-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.h7
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();
}