Bug 1246331: Make unary decoding expect the real type, not the parent type; r=sunfish

This commit is contained in:
Benjamin Bouvier 2016-02-08 11:57:11 +01:00
parent 47f1c05064
commit 93cadf3a5a
3 changed files with 3 additions and 1 deletions

View File

@ -268,7 +268,7 @@ static bool
DecodeUnaryOperator(FunctionDecoder& f, ExprType expected, ExprType type)
{
return CheckType(f, type, expected) &&
DecodeExpr(f, expected);
DecodeExpr(f, type);
}
static bool

View File

@ -2637,6 +2637,7 @@ EmitExpr(FunctionCompiler& f, ExprType type, MDefinition** def, LabelVector* may
switch (Expr op = f.readOpcode()) {
case Expr::Nop:
*def = nullptr;
return true;
case Expr::Block:
return EmitBlock(f, type, def);

View File

@ -64,6 +64,7 @@ assertErrorMessage(() => wasmEvalText('(module (func (param i32) (result i32) (f
assertErrorMessage(() => wasmEvalText('(module (func (param i32) (result f64) (f64.sqrt (get_local 0))))'), TypeError, mismatchError("i32", "f64"));
assertErrorMessage(() => wasmEvalText('(module (func (param f64) (result i32) (f64.sqrt (get_local 0))))'), TypeError, mismatchError("f64", "i32"));
assertErrorMessage(() => wasmEvalText('(module (func (param i32) (result i32) (f64.sqrt (get_local 0))))'), TypeError, mismatchError("f64", "i32"));
assertErrorMessage(() => wasmEvalText('(module (func (f32.sqrt (nop))))'), TypeError, mismatchError("void", "f32"));
assertErrorMessage(() => wasmEvalText('(module (func (param i32) (param f32) (result f32) (f32.add (get_local 0) (get_local 1))))'), TypeError, mismatchError("i32", "f32"));
assertErrorMessage(() => wasmEvalText('(module (func (param f32) (param i32) (result f32) (f32.add (get_local 0) (get_local 1))))'), TypeError, mismatchError("i32", "f32"));