Fix: check if next statement is on newline when warning against extra semicolons. (fixes #1580)

Details are explained in #1580.