Skip to content

Instantly share code, notes, and snippets.

@vjeux
Created Apr 12, 2017
Embed
What would you like to do?
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