mirror of https://github.com/sveltejs/svelte
fix misaligned line numbers in sourcemaps (#4738)
parent
e3fef0f740
commit
cf72b41575
@ -0,0 +1,9 @@
|
|||||||
|
<!--
|
||||||
|
Multiline
|
||||||
|
comment
|
||||||
|
-->
|
||||||
|
<script>
|
||||||
|
function assertThisLine() {}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{foo.bar.baz}
|
@ -0,0 +1,16 @@
|
|||||||
|
export function test({ assert, smc, locateInSource, locateInGenerated }) {
|
||||||
|
const expected = locateInSource( 'assertThisLine' );
|
||||||
|
const start = locateInGenerated( 'assertThisLine' );
|
||||||
|
|
||||||
|
const actual = smc.originalPositionFor({
|
||||||
|
line: start.line + 1,
|
||||||
|
column: start.column
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.deepEqual( actual, {
|
||||||
|
source: 'input.svelte',
|
||||||
|
name: null,
|
||||||
|
line: expected.line + 1,
|
||||||
|
column: expected.column
|
||||||
|
});
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
<script context="module">
|
||||||
|
export let first;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function assertThisLine() {}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{foo.bar.baz}
|
@ -0,0 +1,16 @@
|
|||||||
|
export function test({ assert, smc, locateInSource, locateInGenerated }) {
|
||||||
|
const expected = locateInSource( 'assertThisLine' );
|
||||||
|
const start = locateInGenerated( 'assertThisLine' );
|
||||||
|
|
||||||
|
const actual = smc.originalPositionFor({
|
||||||
|
line: start.line + 1,
|
||||||
|
column: start.column
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.deepEqual( actual, {
|
||||||
|
source: 'input.svelte',
|
||||||
|
name: null,
|
||||||
|
line: expected.line + 1,
|
||||||
|
column: expected.column
|
||||||
|
});
|
||||||
|
}
|
Loading…
Reference in new issue