pull/4000/head
daszgfz 6 years ago
parent 0fb0f16d72
commit 7703e22051

@ -1137,7 +1137,7 @@ export default class Component {
for (const [name, node] of top_level_function_declarations) { for (const [name, node] of top_level_function_declarations) {
if (is_hoistable(node)) { if (is_hoistable(node)) {
const variable = this.var_lookup.get(name); const variable = this.var_lookup.get(name);
if ('argument' in variable && !variable.argument) { if (!('argument' in variable && variable.argument)) {
variable.hoistable = true; variable.hoistable = true;
hoistable_nodes.add(node); hoistable_nodes.add(node);

@ -21,10 +21,10 @@ function create_fragment(ctx) {
}, },
m(target, anchor) { m(target, anchor) {
insert(target, button, anchor); insert(target, button, anchor);
foo_action = /*foo*/ ctx[2].call(null, button, /*foo_function*/ ctx[3]) || ({}); foo_action = foo.call(null, button, /*foo_function*/ ctx[1]) || ({});
}, },
p(ctx, [dirty]) { p(ctx, [dirty]) {
if (is_function(foo_action.update) && dirty & /*bar*/ 1) foo_action.update.call(null, /*foo_function*/ ctx[3]); if (is_function(foo_action.update) && dirty & /*bar*/ 1) foo_action.update.call(null, /*foo_function*/ ctx[1]);
}, },
i: noop, i: noop,
o: noop, o: noop,
@ -35,24 +35,23 @@ function create_fragment(ctx) {
}; };
} }
function instance($$self, $$props, $$invalidate) { function handleFoo(bar) {
let { bar } = $$props; console.log(bar);
}
function handleFoo(bar) {
console.log(bar);
}
function foo(node, callback) { function foo(node, callback) {
} }
function instance($$self, $$props, $$invalidate) {
let { bar } = $$props;
const foo_function = () => handleFoo(bar); const foo_function = () => handleFoo(bar);
$$self.$set = $$props => { $$self.$set = $$props => {
if ("bar" in $$props) $$invalidate(0, bar = $$props.bar); if ("bar" in $$props) $$invalidate(0, bar = $$props.bar);
}; };
return [bar, handleFoo, foo, foo_function]; return [bar, foo_function];
} }
class Component extends SvelteComponent { class Component extends SvelteComponent {

@ -23,7 +23,7 @@ function create_fragment(ctx) {
}, },
m(target, anchor) { m(target, anchor) {
insert(target, a, anchor); insert(target, a, anchor);
link_action = /*link*/ ctx[0].call(null, a) || ({}); link_action = link.call(null, a) || ({});
}, },
p: noop, p: noop,
i: noop, i: noop,
@ -35,29 +35,25 @@ function create_fragment(ctx) {
}; };
} }
function instance($$self) { function link(node) {
function link(node) { function onClick(event) {
function onClick(event) { event.preventDefault();
event.preventDefault(); history.pushState(null, null, event.target.href);
history.pushState(null, null, event.target.href);
}
node.addEventListener("click", onClick);
return {
destroy() {
node.removeEventListener("click", onClick);
}
};
} }
return [link]; node.addEventListener("click", onClick);
return {
destroy() {
node.removeEventListener("click", onClick);
}
};
} }
class Component extends SvelteComponent { class Component extends SvelteComponent {
constructor(options) { constructor(options) {
super(); super();
init(this, options, instance, create_fragment, safe_not_equal, {}); init(this, options, null, create_fragment, safe_not_equal, {});
} }
} }

@ -17,7 +17,7 @@ function create_fragment(ctx) {
return { return {
c() { c() {
input = element("input"); input = element("input");
dispose = listen(input, "input", /*make_uppercase*/ ctx[0]); dispose = listen(input, "input", make_uppercase);
}, },
m(target, anchor) { m(target, anchor) {
insert(target, input, anchor); insert(target, input, anchor);
@ -32,18 +32,14 @@ function create_fragment(ctx) {
}; };
} }
function instance($$self) { function make_uppercase() {
function make_uppercase() { this.value = this.value.toUpperCase();
this.value = this.value.toUpperCase();
}
return [make_uppercase];
} }
class Component extends SvelteComponent { class Component extends SvelteComponent {
constructor(options) { constructor(options) {
super(); super();
init(this, options, instance, create_fragment, safe_not_equal, {}); init(this, options, null, create_fragment, safe_not_equal, {});
} }
} }

@ -19,14 +19,14 @@ import {
function get_each_context(ctx, list, i) { function get_each_context(ctx, list, i) {
const child_ctx = ctx.slice(); const child_ctx = ctx.slice();
child_ctx[2] = list[i]; child_ctx[1] = list[i];
return child_ctx; return child_ctx;
} }
// (19:0) {#each things as thing (thing.id)} // (19:0) {#each things as thing (thing.id)}
function create_each_block(key_1, ctx) { function create_each_block(key_1, ctx) {
let div; let div;
let t_value = /*thing*/ ctx[2].name + ""; let t_value = /*thing*/ ctx[1].name + "";
let t; let t;
let rect; let rect;
let stop_animation = noop; let stop_animation = noop;
@ -44,7 +44,7 @@ function create_each_block(key_1, ctx) {
append(div, t); append(div, t);
}, },
p(ctx, dirty) { p(ctx, dirty) {
if (dirty & /*things*/ 1 && t_value !== (t_value = /*thing*/ ctx[2].name + "")) set_data(t, t_value); if (dirty & /*things*/ 1 && t_value !== (t_value = /*thing*/ ctx[1].name + "")) set_data(t, t_value);
}, },
r() { r() {
rect = div.getBoundingClientRect(); rect = div.getBoundingClientRect();
@ -55,7 +55,7 @@ function create_each_block(key_1, ctx) {
}, },
a() { a() {
stop_animation(); stop_animation();
stop_animation = create_animation(div, rect, /*foo*/ ctx[1], {}); stop_animation = create_animation(div, rect, foo, {});
}, },
d(detaching) { d(detaching) {
if (detaching) detach(div); if (detaching) detach(div);
@ -68,7 +68,7 @@ function create_fragment(ctx) {
let each_1_lookup = new Map(); let each_1_lookup = new Map();
let each_1_anchor; let each_1_anchor;
let each_value = /*things*/ ctx[0]; let each_value = /*things*/ ctx[0];
const get_key = ctx => /*thing*/ ctx[2].id; const get_key = ctx => /*thing*/ ctx[1].id;
for (let i = 0; i < each_value.length; i += 1) { for (let i = 0; i < each_value.length; i += 1) {
let child_ctx = get_each_context(ctx, each_value, i); let child_ctx = get_each_context(ctx, each_value, i);
@ -109,28 +109,28 @@ function create_fragment(ctx) {
}; };
} }
function instance($$self, $$props, $$invalidate) { function foo(node, animation, params) {
let { things } = $$props; const dx = animation.from.left - animation.to.left;
const dy = animation.from.top - animation.to.top;
function foo(node, animation, params) { return {
const dx = animation.from.left - animation.to.left; delay: params.delay,
const dy = animation.from.top - animation.to.top; duration: 100,
tick: (t, u) => {
node.dx = u * dx;
node.dy = u * dy;
}
};
}
return { function instance($$self, $$props, $$invalidate) {
delay: params.delay, let { things } = $$props;
duration: 100,
tick: (t, u) => {
node.dx = u * dx;
node.dy = u * dy;
}
};
}
$$self.$set = $$props => { $$self.$set = $$props => {
if ("things" in $$props) $$invalidate(0, things = $$props.things); if ("things" in $$props) $$invalidate(0, things = $$props.things);
}; };
return [things, foo]; return [things];
} }
class Component extends SvelteComponent { class Component extends SvelteComponent {

@ -37,10 +37,10 @@ function create_fragment(ctx) {
button2.textContent = "or me!"; button2.textContent = "or me!";
dispose = [ dispose = [
listen(button0, "click", stop_propagation(prevent_default(/*handleClick*/ ctx[1]))), listen(button0, "click", stop_propagation(prevent_default(handleClick))),
listen(button1, "click", /*handleClick*/ ctx[1], { once: true, capture: true }), listen(button1, "click", handleClick, { once: true, capture: true }),
listen(button2, "click", /*handleClick*/ ctx[1], true), listen(button2, "click", handleClick, true),
listen(div, "touchstart", /*handleTouchstart*/ ctx[0], { passive: true }) listen(div, "touchstart", handleTouchstart, { passive: true })
]; ];
}, },
m(target, anchor) { m(target, anchor) {
@ -61,22 +61,18 @@ function create_fragment(ctx) {
}; };
} }
function instance($$self) { function handleTouchstart() {
function handleTouchstart() {
} }
function handleClick() {
} function handleClick() {
return [handleTouchstart, handleClick];
} }
class Component extends SvelteComponent { class Component extends SvelteComponent {
constructor(options) { constructor(options) {
super(); super();
init(this, options, instance, create_fragment, safe_not_equal, {}); init(this, options, null, create_fragment, safe_not_equal, {});
} }
} }

@ -15,7 +15,7 @@ function create_fragment(ctx) {
return { return {
c() { c() {
b = element("b"); b = element("b");
b.textContent = `${/*get_answer*/ ctx[0]()}`; b.textContent = `${get_answer()}`;
}, },
m(target, anchor) { m(target, anchor) {
insert(target, b, anchor); insert(target, b, anchor);
@ -31,18 +31,14 @@ function create_fragment(ctx) {
const ANSWER = 42; const ANSWER = 42;
function instance($$self) { function get_answer() {
function get_answer() { return ANSWER;
return ANSWER;
}
return [get_answer];
} }
class Component extends SvelteComponent { class Component extends SvelteComponent {
constructor(options) { constructor(options) {
super(); super();
init(this, options, instance, create_fragment, safe_not_equal, {}); init(this, options, null, create_fragment, safe_not_equal, {});
} }
} }

@ -15,7 +15,7 @@ function create_fragment(ctx) {
return { return {
c() { c() {
b = element("b"); b = element("b");
b.textContent = `${/*get_answer*/ ctx[0]()}`; b.textContent = `${get_answer()}`;
}, },
m(target, anchor) { m(target, anchor) {
insert(target, b, anchor); insert(target, b, anchor);
@ -31,18 +31,14 @@ function create_fragment(ctx) {
let ANSWER = 42; let ANSWER = 42;
function instance($$self) { function get_answer() {
function get_answer() { return ANSWER;
return ANSWER;
}
return [get_answer];
} }
class Component extends SvelteComponent { class Component extends SvelteComponent {
constructor(options) { constructor(options) {
super(); super();
init(this, options, instance, create_fragment, safe_not_equal, {}); init(this, options, null, create_fragment, safe_not_equal, {});
} }
} }

@ -3,11 +3,11 @@ import { SvelteComponent, init, safe_not_equal } from "svelte/internal";
const SOME_CONSTANT = 42; const SOME_CONSTANT = 42;
function instance($$self, $$props, $$invalidate) { function foo(bar) {
function foo(bar) { console.log(bar);
console.log(bar); }
}
function instance($$self, $$props, $$invalidate) {
return [foo]; return [foo];
} }
@ -18,7 +18,7 @@ class Component extends SvelteComponent {
} }
get foo() { get foo() {
return this.$$.ctx[0]; return foo;
} }
} }

@ -7,6 +7,14 @@ function preload(input) {
return output; return output;
} }
function foo() {
console.log("foo");
}
function swipe(node, callback) {
}
const Component = create_ssr_component(($$result, $$props, $$bindings, $$slots) => { const Component = create_ssr_component(($$result, $$props, $$bindings, $$slots) => {
onMount(() => { onMount(() => {
console.log("onMount"); console.log("onMount");
@ -16,14 +24,6 @@ const Component = create_ssr_component(($$result, $$props, $$bindings, $$slots)
console.log("onDestroy"); console.log("onDestroy");
}); });
function foo() {
console.log("foo");
}
function swipe(node, callback) {
}
return ``; return ``;
}); });

@ -65,7 +65,7 @@ function create_if_block_1(ctx) {
if (local) { if (local) {
if (!div_intro) { if (!div_intro) {
add_render_callback(() => { add_render_callback(() => {
div_intro = create_in_transition(div, /*foo*/ ctx[2], {}); div_intro = create_in_transition(div, foo, {});
div_intro.start(); div_intro.start();
}); });
} }
@ -114,20 +114,20 @@ function create_fragment(ctx) {
}; };
} }
function foo() {
}
function instance($$self, $$props, $$invalidate) { function instance($$self, $$props, $$invalidate) {
let { x } = $$props; let { x } = $$props;
let { y } = $$props; let { y } = $$props;
function foo() {
}
$$self.$set = $$props => { $$self.$set = $$props => {
if ("x" in $$props) $$invalidate(0, x = $$props.x); if ("x" in $$props) $$invalidate(0, x = $$props.x);
if ("y" in $$props) $$invalidate(1, y = $$props.y); if ("y" in $$props) $$invalidate(1, y = $$props.y);
}; };
return [x, y, foo]; return [x, y];
} }
class Component extends SvelteComponent { class Component extends SvelteComponent {

Loading…
Cancel
Save