Merge branch 'master' of https://github.com/bre30kra69cs/svelte into bre30kra69cs-master

pull/3529/head
Richard Harris 5 years ago
commit 8325ca206b

@ -248,6 +248,11 @@ export default function dom(
code.appendLeft(node.end, `${code.original[node.end - 1] === ';' ? '' : ';'} ${insert};`);
}
pending_assignments = new Set();
} else if (parent && parent.type !== 'ForStatement' && node.type === 'VariableDeclaration') {
const insert = Array.from(pending_assignments).map(name => component.invalidate(name)).join('; ');
code.appendLeft(node.end, `${code.original[node.end - 1] === ';' ? '' : ';'} ${insert};`);
pending_assignments = new Set();
}
}

@ -0,0 +1,72 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent,
append,
detach,
element,
init,
insert,
noop,
safe_not_equal,
set_data,
space,
text
} from "svelte/internal";
function create_fragment(ctx) {
var h1, t0, t1, t2;
return {
c() {
h1 = element("h1");
t0 = text(ctx.foo);
t1 = space();
t2 = text(ctx.eid);
},
m(target, anchor) {
insert(target, h1, anchor);
append(h1, t0);
append(h1, t1);
append(h1, t2);
},
p(changed, ctx) {
if (changed.foo) {
set_data(t0, ctx.foo);
}
if (changed.eid) {
set_data(t2, ctx.eid);
}
},
i: noop,
o: noop,
d(detaching) {
if (detaching) {
detach(h1);
}
}
};
}
function instance($$self, $$props, $$invalidate) {
let eid = 1;
let foo;
let employees = [
{id: eid = (foo = 2), name: 'xxx'},
]; $$invalidate('foo', foo); $$invalidate('eid', eid);
return { eid, foo };
}
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, []);
}
}
export default Component;

@ -0,0 +1,9 @@
<script>
let eid = 1;
let foo;
let employees = [
{id: eid = (foo = 2), name: 'xxx'},
]
</script>
<h1>{foo} {eid}</h1>

@ -0,0 +1,68 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent,
append,
detach,
element,
init,
insert,
noop,
safe_not_equal,
set_data,
space,
text
} from "svelte/internal";
function create_fragment(ctx) {
var h1, t0, t1, t2;
return {
c() {
h1 = element("h1");
t0 = text(ctx.foo1);
t1 = space();
t2 = text(ctx.foo2);
},
m(target, anchor) {
insert(target, h1, anchor);
append(h1, t0);
append(h1, t1);
append(h1, t2);
},
p(changed, ctx) {
if (changed.foo1) {
set_data(t0, ctx.foo1);
}
},
i: noop,
o: noop,
d(detaching) {
if (detaching) {
detach(h1);
}
}
};
}
function instance($$self, $$props, $$invalidate) {
let foo1;
let foo2;
for (let bar = (foo1 = 0); bar < 5; bar += 1) {
$$invalidate('foo1', foo1 = foo2); $$invalidate('foo1', foo1);
}
return { foo1, foo2 };
}
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, []);
}
}
export default Component;

@ -0,0 +1,9 @@
<script>
let foo1;
let foo2;
for (let bar = (foo1 = 0); bar < 5; bar += 1) {
foo1 = foo2;
}
</script>
<h1>{foo1} {foo2}</h1>

@ -0,0 +1,65 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent,
append,
detach,
element,
init,
insert,
noop,
safe_not_equal,
set_data,
space,
text
} from "svelte/internal";
function create_fragment(ctx) {
var h1, t0, t1, t2;
return {
c() {
h1 = element("h1");
t0 = text(ctx.foo);
t1 = space();
t2 = text(ctx.bar);
},
m(target, anchor) {
insert(target, h1, anchor);
append(h1, t0);
append(h1, t1);
append(h1, t2);
},
p(changed, ctx) {
if (changed.foo) {
set_data(t0, ctx.foo);
}
},
i: noop,
o: noop,
d(detaching) {
if (detaching) {
detach(h1);
}
}
};
}
function instance($$self, $$props, $$invalidate) {
let foo;
let bar = (foo = 1); $$invalidate('foo', foo);
return { foo, bar };
}
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, []);
}
}
export default Component;

@ -0,0 +1,6 @@
<script>
let foo;
let bar = (foo = 1);
</script>
<h1>{foo} {bar}</h1>

@ -0,0 +1,70 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent,
append,
detach,
element,
init,
insert,
noop,
safe_not_equal,
set_data,
space,
text
} from "svelte/internal";
function create_fragment(ctx) {
var h1, t0, t1, t2;
return {
c() {
h1 = element("h1");
t0 = text(ctx.foo);
t1 = space();
t2 = text(ctx.bar);
},
m(target, anchor) {
insert(target, h1, anchor);
append(h1, t0);
append(h1, t1);
append(h1, t2);
},
p(changed, ctx) {
if (changed.foo) {
set_data(t0, ctx.foo);
}
if (changed.bar) {
set_data(t2, ctx.bar);
}
},
i: noop,
o: noop,
d(detaching) {
if (detaching) {
detach(h1);
}
}
};
}
function instance($$self, $$props, $$invalidate) {
let foo;
let bar;
$$invalidate('bar', bar = (foo = 1)); $$invalidate('foo', foo);
return { foo, bar };
}
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, []);
}
}
export default Component;

@ -0,0 +1,7 @@
<script>
let foo;
let bar;
bar = (foo = 1);
</script>
<h1>{foo} {bar}</h1>
Loading…
Cancel
Save