Fix unreachable insertion when returning none (#557)

This commit is contained in:
Max Graey
2019-03-24 11:18:05 +02:00
committed by Daniel Wirtz
parent f9a8d2f1db
commit 74ce9bf386
3 changed files with 70 additions and 54 deletions

View File

@ -1746,13 +1746,8 @@ export class BinaryModule {
/** Tests if an expression needs an explicit 'unreachable' when it is the terminating statement. */
export function needsExplicitUnreachable(expr: ExpressionRef): bool {
// not applicable if pushing a value to the stack
switch (_BinaryenExpressionGetType(expr)) {
case NativeType.I32:
case NativeType.I64:
case NativeType.F32:
case NativeType.F64:
case NativeType.V128: return false;
}
if (_BinaryenExpressionGetType(expr) != NativeType.Unreachable) return false;
switch (_BinaryenExpressionGetId(expr)) {
case ExpressionId.Unreachable:
case ExpressionId.Return: return false;