diff --git a/transpiler/java/com/google/j2cl/transpiler/backend/Backend.java b/transpiler/java/com/google/j2cl/transpiler/backend/Backend.java index e518d089b3..d721c131bc 100644 --- a/transpiler/java/com/google/j2cl/transpiler/backend/Backend.java +++ b/transpiler/java/com/google/j2cl/transpiler/backend/Backend.java @@ -674,11 +674,8 @@ public ImmutableList> getPassFactories(BackendOption // Post-verifications VerifySingleAstReference::new, VerifyParamAndArgCounts::new, - VerifyReferenceScoping::new - - // TODO(b/283154833): Add the invariants for modular_wasm - // () -> new VerifyNormalizedUnits(/* verifyForWasm= **/ true) - ); + VerifyReferenceScoping::new, + () -> new VerifyNormalizedUnits(/* verifyForWasm= **/ true)); } @Override diff --git a/transpiler/java/com/google/j2cl/transpiler/passes/VerifyNormalizedUnits.java b/transpiler/java/com/google/j2cl/transpiler/passes/VerifyNormalizedUnits.java index df84e54ae3..ec05112f55 100644 --- a/transpiler/java/com/google/j2cl/transpiler/passes/VerifyNormalizedUnits.java +++ b/transpiler/java/com/google/j2cl/transpiler/passes/VerifyNormalizedUnits.java @@ -309,8 +309,10 @@ public void exitSwitchExpression(SwitchExpression switchExpression) { @Override public void exitYieldStatement(YieldStatement yieldStatement) { - // Yield statements are expected to be normalized away. - throw new IllegalStateException(); + if (!verifyForWasm) { + // Yield statements are expected to be normalized away. + throw new IllegalStateException(); + } } @Override