Skip to content

Commit 794a1cc

Browse files
committed
fix: append start/end info to more tags
We should add them everywhere we can Related sveltejs/language-tools#2385
1 parent 7714c93 commit 794a1cc

File tree

1 file changed

+5
-2
lines changed
  • packages/svelte/src/compiler/phases/1-parse/state

1 file changed

+5
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,10 +281,13 @@ function open(parser) {
281281
parser.allow_whitespace();
282282
if (parser.eat('=')) {
283283
parser.allow_whitespace();
284+
const right = read_expression(parser);
284285
pattern = {
285286
type: 'AssignmentPattern',
286287
left: pattern,
287-
right: read_expression(parser)
288+
right: right,
289+
start: pattern.start,
290+
end: right.end
288291
};
289292
}
290293

@@ -572,7 +575,7 @@ function special(parser) {
572575
declaration: {
573576
type: 'VariableDeclaration',
574577
kind: 'const',
575-
declarations: [{ type: 'VariableDeclarator', id, init }],
578+
declarations: [{ type: 'VariableDeclarator', id, init, start: id.start, end: init.end }],
576579
start: start + 2, // start at const, not at @const
577580
end: parser.index - 1
578581
}

0 commit comments

Comments
 (0)