Skip to content

Commit

Permalink
fix: append start/end info to more tags
Browse files Browse the repository at this point in the history
We should add them everywhere we can
Related sveltejs/language-tools#2385
  • Loading branch information
dummdidumm committed Jun 6, 2024
1 parent 7714c93 commit 794a1cc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/svelte/src/compiler/phases/1-parse/state/tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,13 @@ function open(parser) {
parser.allow_whitespace();
if (parser.eat('=')) {
parser.allow_whitespace();
const right = read_expression(parser);
pattern = {
type: 'AssignmentPattern',
left: pattern,
right: read_expression(parser)
right: right,
start: pattern.start,
end: right.end
};
}

Expand Down Expand Up @@ -572,7 +575,7 @@ function special(parser) {
declaration: {
type: 'VariableDeclaration',
kind: 'const',
declarations: [{ type: 'VariableDeclarator', id, init }],
declarations: [{ type: 'VariableDeclarator', id, init, start: id.start, end: init.end }],
start: start + 2, // start at const, not at @const
end: parser.index - 1
}
Expand Down

0 comments on commit 794a1cc

Please sign in to comment.