summaryrefslogtreecommitdiff
path: root/src/wasm/wasm.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm/wasm.cpp')
-rw-r--r--src/wasm/wasm.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/wasm/wasm.cpp b/src/wasm/wasm.cpp
index 6f7ea4f86..87981729e 100644
--- a/src/wasm/wasm.cpp
+++ b/src/wasm/wasm.cpp
@@ -992,11 +992,11 @@ Index Function::getLocalIndex(Name name) {
Index Function::getVarIndexBase() { return sig.params.size(); }
Type Function::getLocalType(Index index) {
- const std::vector<Type>& params = sig.params.expand();
- if (index < params.size()) {
- return params[index];
+ auto numParams = sig.params.size();
+ if (index < numParams) {
+ return sig.params.expand()[index];
} else if (isVar(index)) {
- return vars[index - params.size()];
+ return vars[index - numParams];
} else {
WASM_UNREACHABLE("invalid local index");
}