change __svelte_meta to __svelte_meta.loc

pull/1501/head
Rich Harris 7 years ago
parent 63a712ccd9
commit d3201603d9

@ -21,5 +21,7 @@ export function callAfter(fn, i) {
} }
export function addLoc(element, file, line, column, char) { export function addLoc(element, file, line, column, char) {
element.__svelte_meta = { file, line, column, char }; element.__svelte_meta = {
loc: { file, line, column, char }
};
} }

@ -68,7 +68,9 @@ function createText(data) {
} }
function addLoc(element, file, line, column, char) { function addLoc(element, file, line, column, char) {
element.__svelte_meta = { file, line, column, char }; element.__svelte_meta = {
loc: { file, line, column, char }
};
} }
function insertNode(node, target, anchor) { function insertNode(node, target, anchor) {

@ -6,7 +6,9 @@ function assign(tar, src) {
} }
function addLoc(element, file, line, column, char) { function addLoc(element, file, line, column, char) {
element.__svelte_meta = { file, line, column, char }; element.__svelte_meta = {
loc: { file, line, column, char }
};
} }
function appendNode(node, target) { function appendNode(node, target) {

@ -7,14 +7,14 @@ export default {
const h1 = target.querySelector('h1'); const h1 = target.querySelector('h1');
const p = target.querySelector('p'); const p = target.querySelector('p');
assert.deepEqual(h1.__svelte_meta, { assert.deepEqual(h1.__svelte_meta.loc, {
file: path.relative(process.cwd(), path.resolve(__dirname, 'main.html')), file: path.relative(process.cwd(), path.resolve(__dirname, 'main.html')),
line: 0, line: 0,
column: 0, column: 0,
char: 0 char: 0
}); });
assert.deepEqual(p.__svelte_meta, { assert.deepEqual(p.__svelte_meta.loc, {
file: path.relative(process.cwd(), path.resolve(__dirname, 'Foo.html')), file: path.relative(process.cwd(), path.resolve(__dirname, 'Foo.html')),
line: 1, line: 1,
column: 1, column: 1,

Loading…
Cancel
Save