|
|
|
|
|
by insin
5237 days ago
|
|
The results aren't unpredictable - they're specified exactly, which makes it safe to omit semicolons except where necessary. You might not know that the return statement is a restricted production, but you do know when you shouldn't immediately follow it with a linebreak. Similarly, if you see a line beginning with ( or [ which isn't a continuation of the statement on the previous line, stick a semicolon in front of it, or in the case of a wrapped function() {}, use one of the other means of telling the parser it's a function expression. There are other restricted productions, but you just solved every non return-followed-by-linebreak ASI issue I've ever seen in the wild. |
|