erlc: replace if expression with case of

Motivated by the bug fix in 2c4d7d1.