static bool DecodeCall(FunctionDecoder& f, ExprType* type) { uint32_t funcIndex; if (!f.d().readVarU32(&funcIndex)) return f.fail("unable to read import index"); if (funcIndex >= f.mg().numFuncSigs()) return f.fail("callee index out of range"); return DecodeCallWithSig(f, f.mg().funcSig(funcIndex), type); }
static bool DecodeCallImport(FunctionDecoder& f, ExprType* type) { uint32_t importIndex; if (!f.d().readVarU32(&importIndex)) return f.fail("unable to read import index"); if (importIndex >= f.mg().numImports()) return f.fail("import index out of range"); return DecodeCallWithSig(f, *f.mg().import(importIndex).sig, type); }
static bool DecodeCallIndirect(FunctionDecoder& f, ExprType expected) { uint32_t sigIndex; if (!f.d().readVarU32(&sigIndex)) return f.fail("unable to read indirect call signature index"); if (sigIndex >= f.mg().numSigs()) return f.fail("signature index out of range"); if (!DecodeExpr(f, ExprType::I32)) return false; return DecodeCallWithSig(f, f.mg().sig(sigIndex), expected); }
static bool DecodeCallImport(FunctionDecoder& f, ExprType expected) { uint32_t importIndex; if (!f.d().readU32(&importIndex)) return f.fail("unable to read import index"); if (importIndex >= f.mg().numImports()) return f.fail("import index out of range"); const DeclaredSig& sig = *f.mg().import(importIndex).sig; for (ValType argType : sig.args()) { if (!DecodeExpr(f, ToExprType(argType))) return false; } return CheckType(f, sig.ret(), expected); }
static bool DecodeCall(FunctionDecoder& f, ExprType expected) { uint32_t funcIndex; if (!f.d().readU32(&funcIndex)) return f.fail("unable to read import index"); if (funcIndex >= f.mg().numFuncSigs()) return f.fail("callee index out of range"); const DeclaredSig& sig = f.mg().funcSig(funcIndex); for (ValType argType : sig.args()) { if (!DecodeExpr(f, ToExprType(argType))) return false; } return CheckType(f, sig.ret(), expected); }