diff options
Diffstat (limited to 'src/wasm-builder.h')
-rw-r--r-- | src/wasm-builder.h | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/wasm-builder.h b/src/wasm-builder.h index 7432562d1..5acac65ee 100644 --- a/src/wasm-builder.h +++ b/src/wasm-builder.h @@ -311,6 +311,7 @@ public: static Index addParam(Function* func, Name name, WasmType type) { // only ok to add a param if no vars, otherwise indices are invalidated assert(func->localIndices.size() == func->params.size()); + assert(name.is()); func->params.push_back(type); Index index = func->localNames.size(); func->localIndices[name] = index; @@ -321,12 +322,8 @@ public: static Index addVar(Function* func, Name name, WasmType type) { // always ok to add a var, it does not affect other indices Index index = func->getNumLocals(); - if (name.is()) { - // if there is a name, apply it, but here we assume all the rest have names too FIXME - assert(func->localIndices.size() == func->params.size() + func->vars.size()); - func->localIndices[name] = index; - func->localNames.push_back(name); - } + if (name.is()) func->localIndices[name] = index; + func->localNames.push_back(name); func->vars.emplace_back(type); return index; } |