JS backend: fixed compiler crashes when translating for with when statement.

#KT-5234 fixed
#EA-57346 fixed