Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: disallow sequence expressions in
@const
tags (#11357)
* fix: disallow sequence expressions in `@const` tags closes #11349 * allow parenthesized sequence expression
- Loading branch information
1 parent
0cf10a3
commit 5e0845f
Showing
6 changed files
with
32 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"svelte": patch | ||
--- | ||
|
||
fix: disallow sequence expressions in `@const` tags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
packages/svelte/tests/compiler-errors/samples/const-tag-sequence/_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { test } from '../../test'; | ||
|
||
export default test({ | ||
error: { | ||
code: 'const_tag_invalid_expression', | ||
message: '{@const ...} must consist of a single variable declaration', | ||
position: [75, 93] | ||
} | ||
}); |
7 changes: 7 additions & 0 deletions
7
packages/svelte/tests/compiler-errors/samples/const-tag-sequence/main.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{#if true} | ||
{@const foo = ('bar', 'baz')} | ||
{/if} | ||
|
||
{#if true} | ||
{@const foo = 'foo', bar = 'bar'} | ||
{/if} |