tweak code generation

pull/1839/head
Rich Harris 7 years ago
parent a390797c4d
commit 9b5589f14d

@ -442,23 +442,25 @@ export default class Component {
let a = script.content.start;
while (/\s/.test(this.source[a])) a += 1;
let b = a;
let result = '';
script.content.body.forEach((node, i) => {
if (this.hoistable_nodes.has(node) || this.reactive_declaration_nodes.has(node)) {
result += `[✂${a}-${node.start}✂]`;
if (a !== b) result += `[✂${a}-${b}✂]`;
a = node.end;
if (i < script.content.body.length - 1) {
while (a < this.source.length && /\s/.test(this.source[a])) a += 1;
}
}
b = node.end;
});
let b = script.content.end;
// while (/\s/.test(this.source[a - 1])) a -= 1;
b = script.content.end;
while (/\s/.test(this.source[b - 1])) b -= 1;
if (a !== b) result += `[✂${a}-${b}✂]`;
if (a < b) result += `[✂${a}-${b}✂]`;
return result || null;
}

@ -72,4 +72,5 @@ class SvelteComponent extends SvelteComponent_1 {
flush();
}
}
export default SvelteComponent;

@ -1,5 +1,5 @@
/* generated by Svelte vX.Y.Z-alpha1 */
import { SvelteComponent as SvelteComponent_1, init, mount_component, safe_not_equal } from "svelte/internal.js";
import { SvelteComponent as SvelteComponent_1, init, mount_component, noop, safe_not_equal } from "svelte/internal.js";
function create_fragment(component, ctx) {
var current;

Loading…
Cancel
Save