summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcheck.py7
-rw-r--r--src/wasm-s-parser.h9
m---------test/spec0
3 files changed, 14 insertions, 2 deletions
diff --git a/check.py b/check.py
index 16a235ec6..45fd08b15 100755
--- a/check.py
+++ b/check.py
@@ -174,6 +174,12 @@ def split_wast(wast):
i = 0
while i >= 0:
start = wast.find('(', i)
+ if start >= 0 and wast[start+1] == ';':
+ # block comment
+ i = wast.find(';)', start+2)
+ assert i > 0, wast[start:]
+ i += 2
+ continue
skip = wast.find(';', i)
if skip >= 0 and skip < start and skip + 1 < len(wast):
if wast[skip+1] == ';':
@@ -188,7 +194,6 @@ def split_wast(wast):
continue
elif chunk.startswith(('(assert', '(invoke')):
ret[-1][1].append(chunk)
- assert len(ret) > 0
return ret
def binary_format_check(wast, verify_final_result=True):
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);
}
}
diff --git a/test/spec b/test/spec
-Subproject 3c92466f5a67d6d81c7c511baf1242c7af9cfd1
+Subproject 86fdbcf887b12463c488d9c10f2011f7066db74