Skip to content

Instantly share code, notes, and snippets.

@vjeux
Created April 12, 2017 22:35
Show Gist options
  • Save vjeux/8548fa1f1d126ffdbe8c6c9e86ccd9e8 to your computer and use it in GitHub Desktop.
Save vjeux/8548fa1f1d126ffdbe8c6c9e86ccd9e8 to your computer and use it in GitHub Desktop.
a(
  SomethingVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLong,
  [
    {
      SomethingVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLong: 1
    }
  ]
);

If you run this on master (or after #927) it prints

a(
  SomethingVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLong,
  [{
      SomethingVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLong: 1
    }]
);

In src/printer.js,

replace

concat(["(", join(concat([", "]), printedLastArgExpanded), ")"]),

by

concat(["(", join(concat([", "]), printed), ")"]),

and see that the output is now the correct

a(
  SomethingVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLong,
  [
    {
      SomethingVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLong: 1
    }
  ]
);

but but but but, this isn't actually printing this line, it's still printing the last argument of the conditionalGroup.

What I don't understand is why changing the first group of a conditionalGroup changes, which doesn't end up being used, changes the behavior of the last one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment