Skip to content
This repository has been archived by the owner on Aug 18, 2021. It is now read-only.

Invalid token type field for nullish coalescing operator #631

Closed
rubennorte opened this issue Jun 14, 2018 · 1 comment
Closed

Invalid token type field for nullish coalescing operator #631

rubennorte opened this issue Jun 14, 2018 · 1 comment

Comments

@rubennorte
Copy link
Contributor

The type field in the token should be a string (as per spec) but it's an object instead.

Example:

parser.parse('foo ?? bar')
Node {
  type: 'Program',
  start: 0,
  end: 10,
  loc:
   SourceLocation {
     start: Position { line: 1, column: 0 },
     end: Position { line: 1, column: 10 } },
  range: [ 0, 10 ],
  comments: [],
  tokens:
   [ Token {
       type: 'Identifier',
       value: 'foo',
       start: 0,
       end: 3,
       loc: [SourceLocation],
       range: [Array] },
     Token {
       type: [BinopTokenType],
       value: '??',
       start: 4,
       end: 6,
       loc: [SourceLocation],
       range: [Array] },
     Token {
       type: 'Identifier',
       value: 'bar',
       start: 7,
       end: 10,
       loc: [SourceLocation],
       range: [Array] } ],
  sourceType: 'module',
  directives: undefined,
  body:
   [ Node {
       type: 'ExpressionStatement',
       start: 0,
       end: 10,
       loc: [SourceLocation],
       range: [Array],
       expression: [Node],
       _babelType: 'ExpressionStatement' } ] }

This was noticed by the ESLint folks in this PR.

@rubennorte
Copy link
Contributor Author

This is also an issue for the pipeline and optional chaining operators.

@hzoo hzoo closed this as completed in #632 Jun 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant