summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2016-02-25 10:48:45 -0800
committerAlon Zakai <alonzakai@gmail.com>2016-02-25 10:48:45 -0800
commit84aa340d56ca3bf8b3ae9a2ea3ba4990f975977e (patch)
treee61dcd66d6ceaa6ee99859a79156f336e2a31654 /src
parent0bc91f2983cfcf44cb94a94454e8b689b58dec43 (diff)
parentad4ce50e5c4d0ef1e530f286f4ebedba4f8a121f (diff)
downloadbinaryen-84aa340d56ca3bf8b3ae9a2ea3ba4990f975977e.tar.gz
binaryen-84aa340d56ca3bf8b3ae9a2ea3ba4990f975977e.tar.bz2
binaryen-84aa340d56ca3bf8b3ae9a2ea3ba4990f975977e.zip
Merge pull request #214 from WebAssembly/new-spec-changes
New spec changes
Diffstat (limited to 'src')
-rw-r--r--src/wasm-s-parser.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/wasm-s-parser.h b/src/wasm-s-parser.h
index 30a9e683f..d0206bcc2 100644
--- a/src/wasm-s-parser.h
+++ b/src/wasm-s-parser.h
@@ -222,6 +222,7 @@ class SExpressionWasmBuilder {
AllocatingModule& wasm;
MixedArena& allocator;
std::function<void ()> onError;
+ std::vector<Name> functionNames;
int functionCounter;
int importCounter;
std::map<Name, WasmType> functionTypes; // we need to know function return types before we parse their contents
@@ -258,6 +259,7 @@ private:
// unnamed, use an index
name = Name::fromInt(functionCounter);
}
+ functionNames.push_back(name);
functionCounter++;
for (;i < s.size(); i++) {
Element& curr = *s[i];
@@ -1036,7 +1038,12 @@ private:
void parseTable(Element& s) {
for (size_t i = 1; i < s.size(); i++) {
- wasm.table.names.push_back(s[i]->str());
+ Name name = s[i]->str();
+ if (!s[i]->dollared()) {
+ // index, we haven't
+ name = functionNames[atoi(name.str)];
+ }
+ wasm.table.names.push_back(name);
}
}