Skip to content

Commit d25a40f

Browse files
authoredNov 28, 2021
Change start location of SvelteAwaitPendingBlock (#113)
1 parent fc7afeb commit d25a40f

File tree

11 files changed

+2011
-17
lines changed

11 files changed

+2011
-17
lines changed
 

‎src/parser/converts/block.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,10 @@ export function convertAwaitBlock(
224224
type: "SvelteAwaitPendingBlock",
225225
children: [],
226226
parent: awaitBlock,
227-
...ctx.getConvertLocation(node.pending),
227+
...ctx.getConvertLocation({
228+
start: awaitBlock.range[0],
229+
end: node.pending.end,
230+
}),
228231
}
229232
ctx.scriptLet.nestBlock(pendingBlock)
230233
pendingBlock.children.push(

‎tests/fixtures/parser/ast/await01-output.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -226,13 +226,13 @@
226226
}
227227
],
228228
"range": [
229-
70,
229+
51,
230230
71
231231
],
232232
"loc": {
233233
"start": {
234234
"line": 5,
235-
"column": 19
235+
"column": 0
236236
},
237237
"end": {
238238
"line": 6,
@@ -392,13 +392,13 @@
392392
}
393393
],
394394
"range": [
395-
117,
395+
98,
396396
118
397397
],
398398
"loc": {
399399
"start": {
400400
"line": 10,
401-
"column": 19
401+
"column": 0
402402
},
403403
"end": {
404404
"line": 11,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<script>
2+
let expression = new Promise()
3+
</script>
4+
5+
{#await expression}{:then}{:catch}{/await}
6+
7+
{#await expression}{:then}{/await}
8+
9+
{#await expression}{:catch}{/await}

0 commit comments

Comments
 (0)
Please sign in to comment.