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