You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/test/js/samples/loop-protect/expected.js

154 lines
2.3 KiB

/* generated by Svelte vX.Y.Z */
import {
SvelteComponentDev,
add_location,
binding_callbacks,
detach_dev,
dispatch_dev,
element,
init,
insert_dev,
loop_guard,
noop,
safe_not_equal
} from "svelte/internal";
const file = undefined;
function create_fragment(ctx) {
let div;
const block = {
c: function create() {
div = element("div");
add_location(div, file, 22, 0, 288);
},
l: function claim(nodes) {
throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
},
m: function mount(target, anchor) {
insert_dev(target, div, anchor);
/*div_binding*/ ctx[1](div);
},
p: noop,
i: noop,
o: noop,
d: function destroy(detaching) {
if (detaching) detach_dev(div);
/*div_binding*/ ctx[1](null);
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_fragment.name,
type: "component",
source: "",
ctx
});
return block;
}
function foo() {
const guard = "foo";
{
const guard_1 = loop_guard(100);
while (true) {
console.log(guard);
guard_1();
}
}
}
function instance($$self, $$props, $$invalidate) {
let node;
{
const guard = loop_guard(100);
while (true) {
foo();
guard();
}
}
{
const guard_2 = loop_guard(100);
for (; ; ) {
foo();
guard_2();
}
}
{
const guard_3 = loop_guard(100);
while (true) {
foo();
guard_3();
}
}
{
const guard_5 = loop_guard(100);
do {
foo();
guard_5();
} while (true);
}
function div_binding($$value) {
binding_callbacks[$$value ? "unshift" : "push"](() => {
$$invalidate(0, node = $$value);
});
}
$$self.$capture_state = () => {
return {};
};
$$self.$inject_state = $$props => {
if ("node" in $$props) $$invalidate(0, node = $$props.node);
};
$: {
const guard_4 = loop_guard(100);
while (true) {
foo();
guard_4();
}
}
$: {
const guard_6 = loop_guard(100);
do {
foo();
guard_6();
} while (true);
}
return [node, div_binding];
}
class Component extends SvelteComponentDev {
constructor(options) {
super(options);
init(this, options, instance, create_fragment, safe_not_equal, {});
dispatch_dev("SvelteRegisterComponent", {
component: this,
tagName: "Component",
options,
id: create_fragment.name
});
}
}
export default Component;