summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/wasm-binary.h1
-rw-r--r--src/wasm-s-parser.h1
-rw-r--r--src/wasm.h4
3 files changed, 6 insertions, 0 deletions
diff --git a/src/wasm-binary.h b/src/wasm-binary.h
index f89ffa23a..c020c3efb 100644
--- a/src/wasm-binary.h
+++ b/src/wasm-binary.h
@@ -1327,6 +1327,7 @@ public:
readExpression(curr->body);
breakStack.pop_back();
breakStack.pop_back();
+ curr->finalize();
}
Name getBreakName(int offset) {
diff --git a/src/wasm-s-parser.h b/src/wasm-s-parser.h
index 34cd168cd..bf9cd239f 100644
--- a/src/wasm-s-parser.h
+++ b/src/wasm-s-parser.h
@@ -834,6 +834,7 @@ private:
ret->body = makeMaybeBlock(s, i);
labelStack.pop_back();
labelStack.pop_back();
+ ret->finalize();
return ret;
}
diff --git a/src/wasm.h b/src/wasm.h
index 528e9c0b0..6c3efbfbe 100644
--- a/src/wasm.h
+++ b/src/wasm.h
@@ -455,6 +455,10 @@ public:
}
return decIndent(o, indent);
}
+
+ void finalize() {
+ type = body->type; // loop might have a type, if the body ends in something that does not break
+ }
};
class Break : public Expression {