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

fix: infinite loop regression in literal (parse/ast) mode #620

Merged
merged 2 commits into from
Nov 11, 2022

Conversation

natemoo-re
Copy link
Member

@natemoo-re natemoo-re commented Nov 11, 2022

Changes

Testing

Tested locally in the prettier-plugin-astro repo, no more hanging

Docs

Bug fix only

@changeset-bot
Copy link

changeset-bot bot commented Nov 11, 2022

🦋 Changeset detected

Latest commit: 6908b2b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@astrojs/compiler Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

return true
case EndExpressionToken:
p.addLoc()
shouldExit := p.exitLiteralIM()
Copy link
Member Author

Choose a reason for hiding this comment

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

Immediately check if we should exit after this token is handled

Comment on lines +2700 to +2703
if shouldExit {
p.im = p.originalIM
p.originalIM = nil
}
Copy link
Member Author

Choose a reason for hiding this comment

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

If we should exit, do it! Resets to the previous insertion mode

p.im = p.originalIM
p.originalIM = nil
}
return true
Copy link
Member Author

Choose a reason for hiding this comment

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

Otherwise, consider this token handled and continue inLiteralIM

@natemoo-re natemoo-re merged commit 8f3e488 into main Nov 11, 2022
@natemoo-re natemoo-re deleted the fix/infinite-loop branch November 11, 2022 17:34
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

Successfully merging this pull request may close these issues.

None yet

2 participants