mirror of https://github.com/sveltejs/svelte
fix: parse declaration tags with a division operator in the initializer (#18353)
Mimic what `parseExpressionAt` does --------- Co-authored-by: hjaber <hjaber@users.noreply.github.com> Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>pull/18346/head
parent
b471c15e61
commit
2afb895ffa
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: parse declaration tag contents more robustly
|
||||
@ -0,0 +1,20 @@
|
||||
<script lang="ts">
|
||||
let visible = true;
|
||||
let total = 10;
|
||||
let width = 16;
|
||||
let height = 9;
|
||||
let divisor = 2;
|
||||
let options: { fallback?: number } = {};
|
||||
</script>
|
||||
|
||||
{#if visible}
|
||||
{const half = total / 2}
|
||||
{let derived = $derived(total / 4)}
|
||||
{const member = width / height}
|
||||
{const call = Math.max(total, 1) / 2}
|
||||
{const string_then_division = 'ab' / divisor}
|
||||
{const typed: number = total / 2}
|
||||
{const { fallback = total / 2 } = options}
|
||||
{const regex = /[}]/}
|
||||
<p>{half} {derived} {member} {call} {string_then_division} {typed} {fallback} {regex}</p>
|
||||
{/if}
|
||||
@ -0,0 +1,20 @@
|
||||
<script lang="ts">
|
||||
let visible = true;
|
||||
let total = 10;
|
||||
let width = 16;
|
||||
let height = 9;
|
||||
let divisor = 2;
|
||||
let options: { fallback?: number } = {};
|
||||
</script>
|
||||
|
||||
{#if visible}
|
||||
{const half = total / 2}
|
||||
{let derived = $derived(total / 4)}
|
||||
{const member = width / height}
|
||||
{const call = Math.max(total, 1) / 2}
|
||||
{const string_then_division = 'ab' / divisor}
|
||||
{const typed: number = total / 2}
|
||||
{const { fallback = total / 2 } = options}
|
||||
{const regex = /[}]/}
|
||||
<p>{half} {derived} {member} {call} {string_then_division} {typed} {fallback} {regex}</p>
|
||||
{/if}
|
||||
Loading…
Reference in new issue