static bool DecodeGetLocal(FunctionDecoder& f, ExprType* type) { uint32_t localIndex; if (!f.d().readVarU32(&localIndex)) return f.fail("unable to read get_local index"); if (localIndex >= f.locals().length()) return f.fail("get_local index out of range"); *type = ToExprType(f.locals()[localIndex]); return true; }
static bool DecodeSetLocal(FunctionDecoder& f, ExprType* type) { uint32_t localIndex; if (!f.d().readVarU32(&localIndex)) return f.fail("unable to read set_local index"); if (localIndex >= f.locals().length()) return f.fail("set_local index out of range"); *type = ToExprType(f.locals()[localIndex]); ExprType rhsType; if (!DecodeExpr(f, &rhsType)) return false; return CheckType(f, rhsType, *type); }