DanielXMoore / Civet

A TypeScript superset that favors more types and less typing
https://civet.dev
MIT License
1.56k stars 33 forks source link

Allow postfix in indented `if` conditions #1612

Closed edemaine closed 1 week ago

edemaine commented 1 week ago

This example came up in Discord: (where 1 and 2 are placeholders for more complex expressions)

if
  1 for every x in y
then
  2

Without this PR:

if(
  1) (()=>{let results=true;for (const x in y)if (!(void 0)) {results = false; break};;return results})()(
  2)

With this PR:

if((()=>{let results=true;for (const x in y) { if (!(
  1)) {results = false; break} }return results})()) {
  2
}