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

When reading a new string, U+2028/2029 should correctly set the new column #10944

Merged
merged 2 commits into from Jan 3, 2020

Conversation

JLHwung
Copy link
Contributor

@JLHwung JLHwung commented Dec 30, 2019

Q                       A
Fixed Issues? Fixes #10435
Patch: Bug Fix? Yes
Tests Added + Pass? Yes
License MIT

As a follow-up to #8866, this PR fixes when the tokenizer reading a string, it does not update the lineStart after U+2028/2029 is read. Note that the lineStart is correctly updated when reading a template token

this.state.lineStart = this.state.pos;

So I consider it as a bug fix to unify the different behaviour here.

@JLHwung JLHwung added PR: Bug Fix 🐛 A type of pull request used for our changelog categories pkg: parser labels Dec 30, 2019
@@ -0,0 +1,2 @@
(`before
after`);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The behaviour of U+2028 in string template is not changed. Adding test here for coverage.

},
"end": {
"line": 2,
"column": 8
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep in mind that the loc here should equals to that of packages/babel-parser/test/fixtures/es2019/json-strings/string-paragraph-separator/output.json.

@nicolo-ribaudo nicolo-ribaudo merged commit 467667a into babel:master Jan 3, 2020
@nicolo-ribaudo nicolo-ribaudo deleted the fix-10435 branch January 3, 2020 22:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: parser PR: Bug Fix 🐛 A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[parser] x2028 and x2029 should increment location lines
3 participants