diff options
Diffstat (limited to 'src/wasm/wasm-validator.cpp')
-rw-r--r-- | src/wasm/wasm-validator.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp index 14955ecae..425792e22 100644 --- a/src/wasm/wasm-validator.cpp +++ b/src/wasm/wasm-validator.cpp @@ -2302,16 +2302,17 @@ void FunctionValidator::visitStructNew(StructNew* curr) { "struct.new_with_default value type must be defaultable"); } } else { - shouldBeEqual(curr->operands.size(), - fields.size(), - curr, - "struct.new must have the right number of operands"); - // All the fields must have the proper type. - for (Index i = 0; i < fields.size(); i++) { - shouldBeSubType(curr->operands[i]->type, - fields[i].type, + if (shouldBeEqual(curr->operands.size(), + fields.size(), curr, - "struct.new operand must have proper type"); + "struct.new must have the right number of operands")) { + // All the fields must have the proper type. + for (Index i = 0; i < fields.size(); i++) { + shouldBeSubType(curr->operands[i]->type, + fields[i].type, + curr, + "struct.new operand must have proper type"); + } } } } |