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

Handle nested expressions edge case #448

Merged
merged 2 commits into from
Jul 6, 2022

Conversation

natemoo-re
Copy link
Member

@natemoo-re natemoo-re commented Jul 6, 2022

Changes

  • Discovered a bug in the course of fixing Support slot attribute inside expressions #447
  • Fixes edge case with multiple nested expressions
  • The tokenizer has some rough heuristics around when braces start an expression vs when they act as raw text
  • Previously, StartTagToken and EndTagToken would reset these heuristics
  • This PR implements a simple stack for StartTagToken and EndTagToken that determines if we're inside elements ({ === StartExpressionToken) or outside of them ({ === TextToken)

Testing

Multiple test cases added

Docs

Bug fix only

@changeset-bot
Copy link

changeset-bot bot commented Jul 6, 2022

🦋 Changeset detected

Latest commit: 071b783

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

@natemoo-re natemoo-re changed the title Fix: handle nested expressions edge case Handle nested expressions edge case Jul 6, 2022
Copy link

@tony-sull tony-sull left a comment

Choose a reason for hiding this comment

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

LGTM

@natemoo-re natemoo-re merged commit 62d2a8e into main Jul 6, 2022
@natemoo-re natemoo-re deleted the fix/nested-expression-edge-case branch July 6, 2022 22:25
natemoo-re added a commit that referenced this pull request Jul 11, 2022
@natemoo-re natemoo-re mentioned this pull request Jul 11, 2022
natemoo-re added a commit that referenced this pull request Jul 11, 2022
* Revert "Handle nested expressions edge case (#448)"

This reverts commit 62d2a8e.

* chore: add changeset

Co-authored-by: Nate Moore <nate@astro.build>
@github-actions github-actions bot mentioned this pull request Jul 11, 2022
natemoo-re added a commit that referenced this pull request Jul 20, 2022
* fix: handle nested expressions edge case

* chore: explain how we use trackPreviousTokens

Co-authored-by: Nate Moore <nate@astro.build>
natemoo-re added a commit that referenced this pull request Jul 20, 2022
* Revert "Handle nested expressions edge case (#448)"

This reverts commit 62d2a8e.

* chore: add changeset

Co-authored-by: Nate Moore <nate@astro.build>
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.

2 participants