From e9c7c20ef84fc5a66823b9fa871f54f98a8a714a Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Fri, 20 May 2016 10:38:48 -0700 Subject: type check loop output type properly --- src/wasm.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/wasm.h') diff --git a/src/wasm.h b/src/wasm.h index fc0337700..839dcf3c2 100644 --- a/src/wasm.h +++ b/src/wasm.h @@ -974,9 +974,13 @@ public: Name out, in; Expression *body; - void finalize() { - type = body->type; // loop might have a type, if the body ends in something that does not break + // set the type of a loop if you already know it + void finalize(WasmType type_) { + type = type_; } + + // set the type of a loop based on its contents. this scans the loop, so it is not fast + void finalize(); }; class Break : public SpecificExpression { -- cgit v1.2.3