Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong location of JSXSpreadChild with comments #235

Closed
fisker opened this issue Jan 31, 2023 · 3 comments
Closed

Wrong location of JSXSpreadChild with comments #235

fisker opened this issue Jan 31, 2023 · 3 comments
Assignees

Comments

@fisker
Copy link
Collaborator

fisker commented Jan 31, 2023

> require('meriyah').parse('<div>{/* comment */...a}</div>;', {jsx: true, loc: true}).body[0].expression.children[0]
{
  type: 'JSXSpreadChild',
  expression: {
    type: 'Identifier',
    name: 'a',
    loc: { start: [Object], end: [Object] }
  },
  loc: { start: { line: 1, column: 19 }, end: { line: 1, column: 24 } }
}

Should be 5-24

@3cp
Copy link
Member

3cp commented Jan 31, 2023

Any spec saying that has to include comment?

@fisker
Copy link
Collaborator Author

fisker commented Jan 31, 2023

I don't know, but other parsers all behave the same (5-24). Isn't it obvious the start location should be location of {. Note the comment is inside {}, why comment location matters in this case?

@3cp
Copy link
Member

3cp commented Jan 31, 2023

Oh I misunderstood the start loc.

@3cp 3cp self-assigned this Jan 31, 2023
@3cp 3cp closed this as completed in 4a99416 Feb 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants