From 525f0a16e22d3a4b2ff95b985d609b6b36c4771c Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Sat, 12 Dec 2015 10:40:18 -0500 Subject: support multiple locals --- src/s2wasm.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/s2wasm.h b/src/s2wasm.h index ed8d3e0e3..b0fe7c431 100644 --- a/src/s2wasm.h +++ b/src/s2wasm.h @@ -246,11 +246,14 @@ private: } else if (match(".result")) { func->result = getType(); } else if (match(".local")) { - Name name = getNextId(); - WasmType type = getType(); - func->locals.emplace_back(name, type); - localTypes[name] = type; - skipWhitespace(); + while (1) { + Name name = getNextId(); + WasmType type = getType(); + func->locals.emplace_back(name, type); + localTypes[name] = type; + skipWhitespace(); + if (!match(",")) break; + } } else break; } // parse body -- cgit v1.2.3