Skip to content

Commit 4b740ae

Browse files
Rich-Harrispaoloricciuti
authored andcommitted
partial fix
1 parent 30d944f commit 4b740ae

File tree

2 files changed

+9
-4
lines changed
  • packages/svelte
    • src/compiler/phases/1-parse/state
    • tests/runtime-runes/samples/snippet-optional-arguments-defaults

2 files changed

+9
-4
lines changed

packages/svelte/src/compiler/phases/1-parse/state/tag.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,18 +281,24 @@ function open(parser) {
281281
parser.allow_whitespace();
282282
if (parser.eat('=')) {
283283
parser.allow_whitespace();
284+
285+
let index = parser.index;
284286
let right = read_expression(parser);
287+
288+
parser.allow_whitespace();
289+
285290
// multiple assignment expression will be confused by the parser for a sequence expression
286291
// so if the returned value is a sequence expression we use the first expression as the
287292
// right and we reset the parser.index
288-
if (right.type === 'SequenceExpression') {
293+
if (right.type === 'SequenceExpression' && parser.template[index] !== '(') {
289294
right = right.expressions[0];
290-
parser.index = right.end ?? parser.index;
295+
parser.index = /** @type {number} */ (right.end);
291296
}
297+
292298
pattern = {
293299
type: 'AssignmentPattern',
294300
left: pattern,
295-
right: right,
301+
right,
296302
start: pattern.start,
297303
end: right.end
298304
};

packages/svelte/tests/runtime-runes/samples/snippet-optional-arguments-defaults/_config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { flushSync } from 'svelte';
21
import { test } from '../../test';
32

43
export default test({

0 commit comments

Comments
 (0)