File tree 1 file changed +10
-6
lines changed
1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -774,18 +774,22 @@ void Asm2WasmBuilder::processAsm(Ref ast) {
774
774
}
775
775
}
776
776
auto importResult = getModule ()->getImport (curr->target )->functionType ->result ;
777
- if (isConcreteWasmType ( curr->type ) ) {
778
- if (curr-> type != importResult ) {
779
- assert (importResult == f64); // we generalized because we had to
777
+ if (curr->type != importResult ) {
778
+ if (importResult == f64 ) {
779
+ // we use a JS f64 value which is the most general, and convert to it
780
780
switch (curr->type ) {
781
781
case i32: replaceCurrent (parent->builder .makeUnary (TruncSFloat64ToInt32, curr)); break ;
782
782
case f32: replaceCurrent (parent->builder .makeUnary (DemoteFloat64, curr)); break ;
783
- default : {} // f64, unreachable, etc., are all good
783
+ case none: replaceCurrent (parent->builder .makeDrop (curr)); break ;
784
+ default : WASM_UNREACHABLE ();
784
785
}
785
- curr->type = importResult;
786
+ } else {
787
+ assert (curr->type == none);
788
+ // we don't want a return value here, but the import does provide one
789
+ replaceCurrent (parent->builder .makeDrop (curr));
786
790
}
791
+ curr->type = importResult;
787
792
}
788
-
789
793
fixParents ();
790
794
}
791
795
You can’t perform that action at this time.
0 commit comments