withastro / compiler

The Astro compiler. Written in Go. Distributed as WASM.
Other
503 stars 59 forks source link

Fix expressions within td exitLiteralIM tracking #885

Closed bluwy closed 1 year ago

bluwy commented 1 year ago

Changes

Fix https://github.com/withastro/compiler/issues/870

For starting expressions within a table cell (td), p.exitLiteralIM (used to check when we can exit the insertion mode while parsing literals) was not assigned so the exit check at

https://github.com/withastro/compiler/blob/f5cff0127d2b2ea59201f6f84d308c57540bde68/internal/parser.go#L2697

Always returned false (default behaviour). Causing any tokens after the first { expression to be considered a literal incorrectly, since it'll never exit the insertion mode.

This PR sets p.exitLiteralIM to fix it, and also fix a slightly unrelated issue where exiting the literal IM in a table returned to a body IM, which I think is incorrect (?).

Testing

Added a new test in go

Docs

n/a. bug fix

changeset-bot[bot] commented 1 year ago

🦋 Changeset detected

Latest commit: f5cff0127d2b2ea59201f6f84d308c57540bde68

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