Skip to content

Commit

Permalink
partial fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed Jun 18, 2024
1 parent ae014ec commit fa455c4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
12 changes: 9 additions & 3 deletions packages/svelte/src/compiler/phases/1-parse/state/tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,18 +281,24 @@ function open(parser) {
parser.allow_whitespace();
if (parser.eat('=')) {
parser.allow_whitespace();

let index = parser.index;
let right = read_expression(parser);

parser.allow_whitespace();

// multiple assignment expression will be confused by the parser for a sequence expression
// so if the returned value is a sequence expression we use the first expression as the
// right and we reset the parser.index
if (right.type === 'SequenceExpression') {
if (right.type === 'SequenceExpression' && parser.template[index] !== '(') {
right = right.expressions[0];
parser.index = right.end ?? parser.index;
parser.index = /** @type {number} */ (right.end);
}

pattern = {
type: 'AssignmentPattern',
left: pattern,
right: right,
right,
start: pattern.start,
end: right.end
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { flushSync } from 'svelte';
import { test } from '../../test';

export default test({
Expand Down

0 comments on commit fa455c4

Please sign in to comment.