File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed
src/compiler/phases/1-parse/state
tests/runtime-runes/samples/snippet-optional-arguments-defaults Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -281,18 +281,24 @@ function open(parser) {
281
281
parser . allow_whitespace ( ) ;
282
282
if ( parser . eat ( '=' ) ) {
283
283
parser . allow_whitespace ( ) ;
284
+
285
+ let index = parser . index ;
284
286
let right = read_expression ( parser ) ;
287
+
288
+ parser . allow_whitespace ( ) ;
289
+
285
290
// multiple assignment expression will be confused by the parser for a sequence expression
286
291
// so if the returned value is a sequence expression we use the first expression as the
287
292
// right and we reset the parser.index
288
- if ( right . type === 'SequenceExpression' ) {
293
+ if ( right . type === 'SequenceExpression' && parser . template [ index ] !== '(' ) {
289
294
right = right . expressions [ 0 ] ;
290
- parser . index = right . end ?? parser . index ;
295
+ parser . index = /** @type { number } */ ( right . end ) ;
291
296
}
297
+
292
298
pattern = {
293
299
type : 'AssignmentPattern' ,
294
300
left : pattern ,
295
- right : right ,
301
+ right,
296
302
start : pattern . start ,
297
303
end : right . end
298
304
} ;
Original file line number Diff line number Diff line change 1
- import { flushSync } from 'svelte' ;
2
1
import { test } from '../../test' ;
3
2
4
3
export default test ( {
You can’t perform that action at this time.
0 commit comments