Skip to content

Unexpected comment attach in Enum #9357

@fisker

Description

@fisker

Flow version: 0.297.0

> require('flow-parser').parse('enum E2 of number {C = 2 /* comment */}',{enums:true,comments:false}).body[0].body.members[0].init

{
  type: 'Literal',
  trailingComments: [
    {
      type: 'Block',
      loc: [Object],
      range: [Array],
      value: ' comment '
    }
  ],
  loc: {
    source: null,
    start: { line: 1, column: 23 },
    end: { line: 1, column: 24 }
  },
  range: [ 23, 24 ],
  value: 2,
  raw: '2'
}

Expected behavior

Should not attach comment to node.

Actual behavior

trailingComments attached to literal.

  • Link to Try-Flow or Github repo:

Try-Flow doesn't support comments option.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions