dynamic imports, hoisting order

pull/3539/head
Richard Harris 6 years ago
parent 51f2b1cd04
commit 85afdef2e5

@ -947,8 +947,8 @@ export default class Component {
const top_level_function_declarations = new Map();
const { body } = this.ast.instance.content;
let i = body.length;
while (i--) {
for (let i = 0; i < body.length; i += 1) {
const node = body[i];
if (node.type === 'VariableDeclaration') {
@ -981,7 +981,7 @@ export default class Component {
hoistable_nodes.add(node);
body.splice(i, 1);
body.splice(i--, 1);
this.fully_hoisted.push(node);
}
}

@ -34,14 +34,14 @@ function create_fragment(ctx) {
};
}
function foo(node, callback) {
}
function handleFoo(bar) {
console.log(bar);
}
function foo(node, callback) {
}
function instance($$self, $$props, $$invalidate) {
let { bar } = $$props;
const foo_function = () => handleFoo(bar);

@ -8,6 +8,7 @@ import {
transition_in,
transition_out
} from "svelte/internal";
import LazyLoad from "./LazyLoad.svelte";
function create_fragment(ctx) {
@ -38,7 +39,7 @@ function create_fragment(ctx) {
};
}
const func = () => import('./Foo.svelte');
const func = () => import("./Foo.svelte");
class Component extends SvelteComponent {
constructor(options) {

@ -34,6 +34,7 @@ function create_fragment(ctx) {
t3 = space();
button2 = element("button");
button2.textContent = "or me!";
dispose = [
listen(button0, "click", stop_propagation(prevent_default(handleClick))),
listen(button1, "click", handleClick, { once: true, capture: true }),

Loading…
Cancel
Save