coffeescript icon indicating copy to clipboard operation
coffeescript copied to clipboard

Bug: Implicit object literals in array split improperly

Open Inve1951 opened this issue 3 years ago • 0 comments

#try

Input Code

a = [
  b1: 1
  b2: 2
, c1: 1
  c2: 2
]

Expected Behavior

var a;

a = [
  {
    b1: 1,
    b2: 2
  },
  {
    c1: 1,
    c2: 2
  }
];

Current Behavior

var a;

a = [
  {
    b1: 1,
    b2: 2
  },
  {
    c1: 1
  },
  {
    c2: 2
  }
];

Context

Fixing this should provide a reasonable alternative to #4952.

Side note: I ran into this issue writing the initial AST tests but never got around to file it (until now). I felt like having read about this syntax/semantics in an official source like coffeescript.org but was unable to find the reference again.

Environment

  • CoffeeScript version: v2.5.1

Inve1951 avatar Jul 29 '20 11:07 Inve1951