print hoisted consts

pull/1890/head
Rich Harris 7 years ago
parent 6a398b0b51
commit a3d609132c

@ -695,6 +695,7 @@ export default class Component {
});
hoistable_nodes.add(node);
this.fully_hoisted.push(`[✂${node.start}-${node.end}✂]`);
}
}

@ -0,0 +1,47 @@
/* generated by Svelte vX.Y.Z */
import { SvelteComponent as SvelteComponent_1, append, createElement, createText, detachNode, init, insert, noop, run, safe_not_equal } from "svelte/internal";
function create_fragment(component, ctx) {
var b, text_value = get_answer(), text, current;
return {
c() {
b = createElement("b");
text = createText(text_value);
},
m(target, anchor) {
insert(target, b, anchor);
append(b, text);
current = true;
},
p: noop,
i(target, anchor) {
if (current) return;
this.m(target, anchor);
},
o: run,
d(detach) {
if (detach) {
detachNode(b);
}
}
};
}
const ANSWER = 42;
function get_answer() { return ANSWER; }
class SvelteComponent extends SvelteComponent_1 {
constructor(options) {
super();
init(this, options, noop, create_fragment, safe_not_equal);
}
}
export default SvelteComponent;

@ -0,0 +1,6 @@
<script>
const ANSWER = 42;
function get_answer() { return ANSWER; }
</script>
<b>{get_answer()}</b>
Loading…
Cancel
Save