summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2020-01-21 10:12:04 -0800
committerGitHub <noreply@github.com>2020-01-21 10:12:04 -0800
commit1e79dcced11cd1da42ca0eb532ee52568c4ab2f0 (patch)
tree7b6e3ab18f4a65100aa919bc98bfecdc353db840 /src
parent2510cff1e02961b7a4da94ce39be59c7e694d342 (diff)
downloadbinaryen-1e79dcced11cd1da42ca0eb532ee52568c4ab2f0.tar.gz
binaryen-1e79dcced11cd1da42ca0eb532ee52568c4ab2f0.tar.bz2
binaryen-1e79dcced11cd1da42ca0eb532ee52568c4ab2f0.zip
Simplify binary parsing a little (#2602)
Instead of hackishly advancing the read position in the binary buffer, call readExpression which will do that, and also do all the debug info handling for us.
Diffstat (limited to 'src')
-rw-r--r--src/wasm/wasm-binary.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp
index a9b14dba3..9c7eb55f2 100644
--- a/src/wasm/wasm-binary.cpp
+++ b/src/wasm/wasm-binary.cpp
@@ -1691,9 +1691,11 @@ void WasmBinaryBuilder::processExpressions() {
peek == BinaryConsts::Catch) {
BYN_TRACE("== processExpressions finished with unreachable"
<< std::endl);
- readNextDebugLocation();
lastSeparator = BinaryConsts::ASTNodes(peek);
- pos++;
+ // Read the byte we peeked at. No new instruction is generated for it.
+ Expression* dummy = nullptr;
+ readExpression(dummy);
+ assert(!dummy);
return;
} else {
skipUnreachableCode();