Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(parser): correctly parse record and tuple tokens#13418

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
JLHwung merged 3 commits intobabel:mainfromfedeci:fix-record-tuple-tokenizer
Jun 9, 2021

Conversation

@fedeci
Copy link
Member

@fedecifedeci commentedJun 3, 2021
edited
Loading

Q                      A
Fixed Issues?Fixes#13417
Patch: Bug Fix?Y
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass?Yes
Documentation PR Link
Any Dependency Changes?
LicenseMIT

#{ and#[ tokens now hold the correct location.
|] and|} are now finished as tokens and not operators.

fisker reacted with thumbs up emojifisker reacted with rocket emoji
@fedecifedeci added pkg: parser PR: Bug Fix 🐛A type of pull request used for our changelog categories labelsJun 3, 2021
@babel-bot
Copy link
Collaborator

babel-bot commentedJun 3, 2021
edited
Loading

Build successful! You can test your changes in the REPL here:https://babeljs.io/repl/build/46719/

@fedeci
Copy link
MemberAuthor

fedeci commentedJun 3, 2021
edited
Loading

I noted that we don't have token specific fixtures, should we add those?
Moreover#13417 also mentions thatvalue for the most of the tokens isundefined. We may do something like this in the Token constructor:

constructor(state:State){this.type=state.type;if(state.value!==undefined){this.value=state.value;}this.start=state.start;this.end=state.end;this.loc=newSourceLocation(state.startLoc,state.endLoc);}

but no tests are throwing, since they are not writingvalue in the output ifundefined.

@fisker
Copy link
Contributor

Thanks for the quick fix, have you checked|} token as well?

fedeci and JLHwung reacted with thumbs up emoji

@nicolo-ribaudo
Copy link
Member

nicolo-ribaudo commentedJun 3, 2021
edited
Loading

I noted that we don't have token specific fixtures, should we add those?

@fedeci You can add a newbabel-parser/test/tokens.js file with normal describe-it-expect Jest tests, or a new subfolder oftest/fixtures.

fedeci reacted with thumbs up emoji

@JLHwung
Copy link
Contributor

We need similar fix for[| and{|.

@KFlash
Copy link

KFlash commentedJun 3, 2021
edited
Loading

That token constructor code is super slow :) Why there is a need for anew SourceLocation. Can't this be a plain object?
And regarding the "missing" value. All object should keep the same shape to avoid hidden classes issue and perf regression in V8.

fedeci reacted with thumbs up emoji

@codesandbox-ci
Copy link

codesandbox-cibot commentedJun 4, 2021
edited
Loading

This pull request is automatically built and testable inCodeSandbox.

To see build info of the built libraries, clickhere or the icon next to each commit SHA.

Latest deployment of this branch, based on commit3d15e07:

SandboxSource
babel-repl-custom-pluginConfiguration
babel-plugin-multi-configConfiguration

@fedecifedeci changed the titlefix(parser): correctly parse token location for#{ and#[fix(parser): correctly parse record and tuple tokensJun 8, 2021
@KFlash
Copy link

@JLHwung No plans to fix the performance issues?

@JLHwung
Copy link
Contributor

@KFlash I am aware of the performance issue here, but fixing the performance falls out of the scope of this PR and thus should be addressed in another PR.

fedeci reacted with thumbs up emoji

@JLHwungJLHwung merged commita64d08c intobabel:mainJun 9, 2021
@fedecifedeci deleted the fix-record-tuple-tokenizer branchJune 9, 2021 04:00
@github-actionsgithub-actionsbot added the outdatedA closed issue/PR that is archived due to age. Recommended to make a new issue labelSep 8, 2021
@github-actionsgithub-actionsbot locked asresolvedand limited conversation to collaboratorsSep 8, 2021
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@JLHwungJLHwungJLHwung approved these changes

@nicolo-ribaudonicolo-ribaudonicolo-ribaudo approved these changes

Assignees

No one assigned

Labels

outdatedA closed issue/PR that is archived due to age. Recommended to make a new issuepkg: parserPR: Bug Fix 🐛A type of pull request used for our changelog categories

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[Bug]:#{ token in Record don't have correct location info &value

6 participants

@fedeci@babel-bot@fisker@nicolo-ribaudo@JLHwung@KFlash

[8]ページ先頭

©2009-2025 Movatter.jp