add comments... sort of

pull/3945/head
Rich Harris 6 years ago
parent 8c50a443b0
commit b8a829e240

@ -199,10 +199,10 @@ export default class Renderer {
? x`$$self.$$.dirty`
: x`#dirty`) as Identifier | MemberExpression;
const get_bitmask = () => names.reduce((bits, name) => {
const get_bitmask = () => names.reduce((bitmask, name) => {
const member = renderer.context_lookup.get(name);
if (!member) return bits;
if (!member) return bitmask;
if (member.index.value === -1) {
throw new Error(`unset index`);
@ -210,12 +210,15 @@ export default class Renderer {
const value = member.index.value as number;
const i = (value / 31) | 0;
const j = 1 << (value % 31);
const n = 1 << (value % 31);
bits[i] |= j;
if (!bitmask[i]) bitmask[i] = { n: 0, names: [] };
return bits;
}, Array((this.context.length / 31) | 0).fill(0));
bitmask[i].n |= n;
bitmask[i].names.push(name);
return bitmask;
}, Array((this.context.length / 31) | 0).fill(null));
let operator;
let left;
@ -233,14 +236,14 @@ export default class Renderer {
if (renderer.context_overflow) {
const expression = bitmask
.map((bits, i) => ({ bits, i }))
.filter(({ bits }) => bits)
.map(({ bits, i }) => x`${dirty}[${i}] & ${bits}`)
.map((b, i) => ({ b, i }))
.filter(({ b }) => b)
.map(({ b, i }) => x`${dirty}[${i}] & /* ${b.names.join(', ')} */ ${b.n}`)
.reduce((lhs, rhs) => x`${lhs} | ${rhs}`);
({ operator, left, right } = expression);
} else {
({ operator, left, right } = x`${dirty} & ${bitmask[0] || 0}` as BinaryExpression); // TODO the `|| 0` case should never apply
({ operator, left, right } = x`${dirty} & /* ${names.join(', ')} */ ${bitmask[0] ? bitmask[0].n : 0}` as BinaryExpression); // TODO the `: 0` case should never apply
}
return 'BinaryExpression';

@ -24,7 +24,7 @@ function create_fragment(ctx) {
foo_action = foo.call(null, button, ctx[1]) || ({});
},
p(ctx, [dirty]) {
if (is_function(foo_action.update) && dirty & 1) foo_action.update.call(null, ctx[1]);
if (is_function(foo_action.update) && dirty & /* _id9uocqrtmw00_1_ */ 1) foo_action.update.call(null, ctx[1]);
},
i: noop,
o: noop,

@ -28,7 +28,7 @@ function create_fragment(ctx) {
details.open = ctx[0];
},
p(ctx, [dirty]) {
if (dirty & 1) {
if (dirty & /* _id9uocqrtmw00_1_ */ 1) {
details.open = ctx[0];
}
},

@ -38,9 +38,9 @@ function create_fragment(ctx) {
set_input_value(input, ctx[0]);
},
p(ctx, [dirty]) {
if (dirty & 1) set_data(t0, ctx[0]);
if (dirty & /* _id9uocqrtmw00_1_ */ 1) set_data(t0, ctx[0]);
if (dirty & 1 && input.value !== ctx[0]) {
if (dirty & /* _id9uocqrtmw00_1_ */ 1 && input.value !== ctx[0]) {
set_input_value(input, ctx[0]);
}
},

@ -35,7 +35,7 @@ function create_fragment(ctx) {
append(p, t);
},
p(ctx, [dirty]) {
if (dirty & 1) set_data(t, ctx[0]);
if (dirty & /* _id9uocqrtmw00_1_ */ 1) set_data(t, ctx[0]);
},
i: noop,
o: noop,

@ -48,10 +48,10 @@ function create_fragment(ctx) {
},
p(ctx, [dirty]) {
const bar_changes = {};
if (dirty & 1) bar_changes.x = ctx[0];
if (dirty & /* _id9uocqrtmw00_1_ */ 1) bar_changes.x = ctx[0];
bar.$set(bar_changes);
if (dirty & 1 && input.value !== ctx[0]) {
if (dirty & /* _id9uocqrtmw00_1_ */ 1 && input.value !== ctx[0]) {
set_input_value(input, ctx[0]);
}
},

@ -29,7 +29,7 @@ function create_fragment(ctx) {
append(h1, t);
},
p(ctx, [dirty]) {
if (dirty & 1) set_data(t, ctx[0]);
if (dirty & /* _id9uocqrtmw00_1_ */ 1) set_data(t, ctx[0]);
},
i: noop,
o: noop,

@ -40,7 +40,7 @@ function create_fragment(ctx) {
insert(target, button, anchor);
},
p(ctx, [dirty]) {
if (dirty & 2) set_data(t0, ctx[1]);
if (dirty & /* _id9uocqrtmw00_1_ */ 2) set_data(t0, ctx[1]);
},
i: noop,
o: noop,

@ -30,7 +30,7 @@ function create_fragment(ctx) {
insert(target, div1, anchor);
},
p(ctx, [dirty]) {
if (dirty & 1) {
if (dirty & /* _id9uocqrtmw00_1_ */ 1) {
attr(div1, "data-foo", ctx[0]);
}
},

@ -45,7 +45,7 @@ function create_fragment(ctx) {
insert_dev(target, t3, anchor);
},
p: function update(ctx, [dirty]) {
if (dirty & 1) set_data_dev(t1, ctx[0]);
if (dirty & /* _id9uocqrtmw00_1_ */ 1) set_data_dev(t1, ctx[0]);
debugger;
},
i: noop,

@ -54,9 +54,9 @@ function create_each_block(ctx) {
insert_dev(target, t1, anchor);
},
p: function update(ctx, dirty) {
if (dirty & 1 && t0_value !== (t0_value = ctx[4].name + "")) set_data_dev(t0, t0_value);
if (dirty & /* _id9uocqrtmw00_1_ */ 1 && t0_value !== (t0_value = ctx[4].name + "")) set_data_dev(t0, t0_value);
if (dirty & 15) {
if (dirty & /* _id9uocqrtmw00_1_ */ 15) {
const foo = ctx[1];
const bar = ctx[2];
const baz = ctx[3];
@ -120,7 +120,7 @@ function create_fragment(ctx) {
append_dev(p, t2);
},
p: function update(ctx, [dirty]) {
if (dirty & 1) {
if (dirty & /* _id9uocqrtmw00_1_ */ 1) {
each_value = ctx[0];
let i;
@ -143,7 +143,7 @@ function create_fragment(ctx) {
each_blocks.length = each_value.length;
}
if (dirty & 2) set_data_dev(t2, ctx[1]);
if (dirty & /* _id9uocqrtmw00_1_ */ 2) set_data_dev(t2, ctx[1]);
},
i: noop,
o: noop,

@ -51,9 +51,9 @@ function create_each_block(ctx) {
insert_dev(target, t1, anchor);
},
p: function update(ctx, dirty) {
if (dirty & 1 && t0_value !== (t0_value = ctx[2].name + "")) set_data_dev(t0, t0_value);
if (dirty & /* _id9uocqrtmw00_1_ */ 1 && t0_value !== (t0_value = ctx[2].name + "")) set_data_dev(t0, t0_value);
if (dirty & 2) {
if (dirty & /* _id9uocqrtmw00_1_ */ 2) {
const foo = ctx[1];
console.log({ foo });
debugger;
@ -114,7 +114,7 @@ function create_fragment(ctx) {
append_dev(p, t2);
},
p: function update(ctx, [dirty]) {
if (dirty & 1) {
if (dirty & /* _id9uocqrtmw00_1_ */ 1) {
each_value = ctx[0];
let i;
@ -137,7 +137,7 @@ function create_fragment(ctx) {
each_blocks.length = each_value.length;
}
if (dirty & 2) set_data_dev(t2, ctx[1]);
if (dirty & /* _id9uocqrtmw00_1_ */ 2) set_data_dev(t2, ctx[1]);
},
i: noop,
o: noop,

@ -24,7 +24,7 @@ function create_fragment(ctx) {
},
m: noop,
p: function update(ctx, [dirty]) {
if (dirty & 3) {
if (dirty & /* _id9uocqrtmw00_1_ */ 3) {
const obj = ctx[0];
const kobzol = ctx[1];
console.log({ obj, kobzol });

@ -89,7 +89,7 @@ function create_fragment(ctx) {
insert_dev(target, each_1_anchor, anchor);
},
p: function update(ctx, [dirty]) {
if (dirty & 0) {
if (dirty & /* _id9uocqrtmw00_1_ */ 0) {
each_value = things;
let i;

@ -36,7 +36,7 @@ function create_each_block(ctx) {
append(span, t);
},
p(ctx, dirty) {
if (dirty & 1 && t_value !== (t_value = ctx[1] + "")) set_data(t, t_value);
if (dirty & /* _id9uocqrtmw00_1_ */ 1 && t_value !== (t_value = ctx[1] + "")) set_data(t, t_value);
},
d(detaching) {
if (detaching) detach(span);
@ -69,7 +69,7 @@ function create_fragment(ctx) {
insert(target, each_1_anchor, anchor);
},
p(ctx, [dirty]) {
if (dirty & 1) {
if (dirty & /* _id9uocqrtmw00_1_ */ 1) {
each_value = ctx[0];
let i;

@ -42,8 +42,8 @@ function create_fragment(ctx) {
append_dev(p, t2);
},
p: function update(ctx, [dirty]) {
if (dirty & 1 && t0_value !== (t0_value = Math.max(0, ctx[0]) + "")) set_data_dev(t0, t0_value);
if (dirty & 2) set_data_dev(t2, ctx[1]);
if (dirty & /* _id9uocqrtmw00_1_ */ 1 && t0_value !== (t0_value = Math.max(0, ctx[0]) + "")) set_data_dev(t0, t0_value);
if (dirty & /* _id9uocqrtmw00_1_ */ 2) set_data_dev(t2, ctx[1]);
},
i: noop,
o: noop,
@ -86,7 +86,7 @@ function instance($$self, $$props, $$invalidate) {
};
$$self.$$.update = () => {
if ($$self.$$.dirty & 1) {
if ($$self.$$.dirty & /* _id9uocqrtmw00_1_ */ 1) {
$: $$invalidate(1, bar = foo * 2);
}
};

@ -36,7 +36,7 @@ function create_each_block(ctx) {
append(span, t);
},
p(ctx, dirty) {
if (dirty & 31 && t_value !== (t_value = ctx[5] + "")) set_data(t, t_value);
if (dirty & /* _id9uocqrtmw00_1_ */ 31 && t_value !== (t_value = ctx[5] + "")) set_data(t, t_value);
},
d(detaching) {
if (detaching) detach(span);
@ -69,7 +69,7 @@ function create_fragment(ctx) {
insert(target, each_1_anchor, anchor);
},
p(ctx, [dirty]) {
if (dirty & 31) {
if (dirty & /* _id9uocqrtmw00_1_ */ 31) {
each_value = [ctx[0], ctx[1], ctx[2], ctx[3], ctx[4]];
let i;

@ -70,9 +70,9 @@ function create_each_block(ctx) {
html_tag.m(div);
},
p(ctx, dirty) {
if (dirty & 1 && t2_value !== (t2_value = ctx[4].author + "")) set_data(t2, t2_value);
if (dirty & 7 && t4_value !== (t4_value = ctx[1](ctx[4].time, ctx[2]) + "")) set_data(t4, t4_value);
if (dirty & 1 && raw_value !== (raw_value = ctx[4].html + "")) html_tag.p(raw_value);
if (dirty & /* _id9uocqrtmw00_1_ */ 1 && t2_value !== (t2_value = ctx[4].author + "")) set_data(t2, t2_value);
if (dirty & /* _id9uocqrtmw00_1_ */ 7 && t4_value !== (t4_value = ctx[1](ctx[4].time, ctx[2]) + "")) set_data(t4, t4_value);
if (dirty & /* _id9uocqrtmw00_1_ */ 1 && raw_value !== (raw_value = ctx[4].html + "")) html_tag.p(raw_value);
},
d(detaching) {
if (detaching) detach(div);
@ -111,7 +111,7 @@ function create_fragment(ctx) {
append(p, t1);
},
p(ctx, [dirty]) {
if (dirty & 7) {
if (dirty & /* _id9uocqrtmw00_1_ */ 7) {
each_value = ctx[0];
let i;
@ -134,7 +134,7 @@ function create_fragment(ctx) {
each_blocks.length = each_value.length;
}
if (dirty & 8) set_data(t1, ctx[3]);
if (dirty & /* _id9uocqrtmw00_1_ */ 8) set_data(t1, ctx[3]);
},
i: noop,
o: noop,

@ -44,7 +44,7 @@ function create_each_block(key_1, ctx) {
append(div, t);
},
p(ctx, dirty) {
if (dirty & 1 && t_value !== (t_value = ctx[1].name + "")) set_data(t, t_value);
if (dirty & /* _id9uocqrtmw00_1_ */ 1 && t_value !== (t_value = ctx[1].name + "")) set_data(t, t_value);
},
r() {
rect = div.getBoundingClientRect();

@ -40,7 +40,7 @@ function create_each_block(key_1, ctx) {
append(div, t);
},
p(ctx, dirty) {
if (dirty & 1 && t_value !== (t_value = ctx[1].name + "")) set_data(t, t_value);
if (dirty & /* _id9uocqrtmw00_1_ */ 1 && t_value !== (t_value = ctx[1].name + "")) set_data(t, t_value);
},
d(detaching) {
if (detaching) detach(div);

@ -63,7 +63,7 @@ function create_fragment(ctx) {
},
p(new_ctx, [dirty]) {
ctx = new_ctx;
if (dirty & 2) set_data(t4, ctx[1]);
if (dirty & /* _id9uocqrtmw00_1_ */ 2) set_data(t4, ctx[1]);
},
i: noop,
o: noop,

@ -23,11 +23,11 @@ function create_fragment(ctx) {
insert(target, div, anchor);
},
p(ctx, [dirty]) {
if (dirty & 1) {
if (dirty & /* _id9uocqrtmw00_1_ */ 1) {
set_style(div, "color", ctx[0]);
}
if (dirty & 6) {
if (dirty & /* _id9uocqrtmw00_1_ */ 6) {
set_style(div, "transform", "translate(" + ctx[1] + "px," + ctx[2] + "px)");
}
},

@ -22,7 +22,7 @@ function create_fragment(ctx) {
insert(target, div, anchor);
},
p(ctx, [dirty]) {
if (dirty & 1) {
if (dirty & /* _id9uocqrtmw00_1_ */ 1) {
set_style(div, "background", "url(data:image/png;base64," + ctx[0] + ")");
}
},

@ -22,7 +22,7 @@ function create_fragment(ctx) {
insert(target, div, anchor);
},
p(ctx, [dirty]) {
if (dirty & 1) {
if (dirty & /* _id9uocqrtmw00_1_ */ 1) {
set_style(div, "color", ctx[0]);
}
},

@ -31,11 +31,11 @@ function create_fragment(ctx) {
insert(target, div1, anchor);
},
p(ctx, [dirty]) {
if (dirty & 1) {
if (dirty & /* _id9uocqrtmw00_1_ */ 1) {
attr(div0, "style", ctx[0]);
}
if (dirty & 6 && div1_style_value !== (div1_style_value = "" + (ctx[1] + ": " + ctx[2]))) {
if (dirty & /* _id9uocqrtmw00_1_ */ 6 && div1_style_value !== (div1_style_value = "" + (ctx[1] + ": " + ctx[2]))) {
attr(div1, "style", div1_style_value);
}
},

@ -41,7 +41,7 @@ function create_fragment(ctx) {
append(form, button);
},
p(ctx, [dirty]) {
if (dirty & 1 && input.value !== ctx[0]) {
if (dirty & /* _id9uocqrtmw00_1_ */ 1 && input.value !== ctx[0]) {
set_input_value(input, ctx[0]);
}
},

@ -29,7 +29,7 @@ function create_fragment(ctx) {
set_input_value(input, ctx[0]);
},
p(ctx, [dirty]) {
if (dirty & 1) {
if (dirty & /* _id9uocqrtmw00_1_ */ 1) {
set_input_value(input, ctx[0]);
}
},

@ -26,7 +26,7 @@ function create_fragment(ctx) {
input.checked = ctx[0];
},
p(ctx, [dirty]) {
if (dirty & 1) {
if (dirty & /* _id9uocqrtmw00_1_ */ 1) {
input.checked = ctx[0];
}
},

@ -40,7 +40,7 @@ function create_fragment(ctx) {
append(p, t3);
},
p(ctx, [dirty]) {
if (dirty & 1) set_data(t3, ctx[0]);
if (dirty & /* _id9uocqrtmw00_1_ */ 1) set_data(t3, ctx[0]);
},
i: noop,
o: noop,

@ -41,7 +41,7 @@ function create_fragment(ctx) {
append(p, t3);
},
p(ctx, [dirty]) {
if (dirty & 1 && t3_value !== (t3_value = ctx[0].length + "")) set_data(t3, t3_value);
if (dirty & /* _id9uocqrtmw00_1_ */ 1 && t3_value !== (t3_value = ctx[0].length + "")) set_data(t3, t3_value);
},
i: noop,
o: noop,

@ -40,7 +40,7 @@ function create_fragment(ctx) {
append(p, t3);
},
p(ctx, [dirty]) {
if (dirty & 1) set_data(t3, ctx[0]);
if (dirty & /* _id9uocqrtmw00_1_ */ 1) set_data(t3, ctx[0]);
},
i: noop,
o: noop,

@ -41,7 +41,7 @@ function create_fragment(ctx) {
append(p, t3);
},
p(ctx, [dirty]) {
if (dirty & 1 && t3_value !== (t3_value = ctx[0].length + "")) set_data(t3, t3_value);
if (dirty & /* _id9uocqrtmw00_1_ */ 1 && t3_value !== (t3_value = ctx[0].length + "")) set_data(t3, t3_value);
},
i: noop,
o: noop,

@ -68,19 +68,19 @@ function create_fragment(ctx) {
}
},
p(ctx, [dirty]) {
if (!audio_updating && dirty & 8 && !isNaN(ctx[3])) {
if (!audio_updating && dirty & /* _id9uocqrtmw00_1_ */ 8 && !isNaN(ctx[3])) {
audio.currentTime = ctx[3];
}
if (dirty & 32 && audio_is_paused !== (audio_is_paused = ctx[5])) {
if (dirty & /* _id9uocqrtmw00_1_ */ 32 && audio_is_paused !== (audio_is_paused = ctx[5])) {
audio[audio_is_paused ? "pause" : "play"]();
}
if (dirty & 64 && !isNaN(ctx[6])) {
if (dirty & /* _id9uocqrtmw00_1_ */ 64 && !isNaN(ctx[6])) {
audio.volume = ctx[6];
}
if (dirty & 128 && !isNaN(ctx[7])) {
if (dirty & /* _id9uocqrtmw00_1_ */ 128 && !isNaN(ctx[7])) {
audio.playbackRate = ctx[7];
}

@ -11,11 +11,11 @@ function instance($$self, $$props, $$invalidate) {
};
$$self.$$.update = () => {
if ($$self.$$.dirty & 1) {
if ($$self.$$.dirty & /* _id9uocqrtmw00_1_ */ 1) {
$: $$invalidate(2, b = x);
}
if ($$self.$$.dirty & 4) {
if ($$self.$$.dirty & /* _id9uocqrtmw00_1_ */ 4) {
$: a = b;
}
};

@ -11,7 +11,7 @@ function instance($$self, $$props, $$invalidate) {
};
$$self.$$.update = () => {
if ($$self.$$.dirty & 3) {
if ($$self.$$.dirty & /* _id9uocqrtmw00_1_ */ 3) {
$: console.log("max", Math.max(a, b));
}
};

@ -44,7 +44,7 @@ function create_fragment(ctx) {
}
},
p(ctx, [dirty]) {
if (dirty & 1 && select_value_value !== (select_value_value = ctx[0])) {
if (dirty & /* _id9uocqrtmw00_1_ */ 1 && select_value_value !== (select_value_value = ctx[0])) {
for (var i = 0; i < select.options.length; i += 1) {
var option = select.options[i];

@ -45,11 +45,11 @@ function create_fragment(ctx) {
insert(target, img1, anchor);
},
p(ctx, [dirty]) {
if (dirty & 1 && img0.src !== (img0_src_value = ctx[0])) {
if (dirty & /* _id9uocqrtmw00_1_ */ 1 && img0.src !== (img0_src_value = ctx[0])) {
attr(img0, "src", img0_src_value);
}
if (dirty & 2 && img1.src !== (img1_src_value = "" + (ctx[1] + ".jpg"))) {
if (dirty & /* _id9uocqrtmw00_1_ */ 2 && img1.src !== (img1_src_value = "" + (ctx[1] + ".jpg"))) {
attr(img1, "src", img1_src_value);
}
},

@ -9,7 +9,7 @@ function create_fragment(ctx) {
c: noop,
m: noop,
p(ctx, [dirty]) {
if (dirty & 1 && title_value !== (title_value = "a " + ctx[0] + " title")) {
if (dirty & /* _id9uocqrtmw00_1_ */ 1 && title_value !== (title_value = "a " + ctx[0] + " title")) {
document.title = title_value;
}
},

@ -57,7 +57,7 @@ function create_fragment(ctx) {
append(p3, t9);
},
p(ctx, [dirty]) {
if (dirty & 1) set_data(t9, ctx[0]);
if (dirty & /* _id9uocqrtmw00_1_ */ 1) set_data(t9, ctx[0]);
},
i: noop,
o: noop,

@ -28,7 +28,7 @@ function create_fragment(ctx) {
append(p, t);
},
p(ctx, [dirty]) {
if (dirty & 1) set_data(t, ctx[0]);
if (dirty & /* _id9uocqrtmw00_1_ */ 1) set_data(t, ctx[0]);
},
i: noop,
o: noop,
@ -58,7 +58,7 @@ function instance($$self, $$props, $$invalidate) {
let y;
$$self.$$.update = () => {
if ($$self.$$.dirty & 2) {
if ($$self.$$.dirty & /* _id9uocqrtmw00_1_ */ 2) {
$: $$invalidate(0, y = b * 2);
}
};

@ -48,7 +48,7 @@ function create_fragment(ctx) {
video_resize_listener = add_resize_listener(video, ctx[4].bind(video));
},
p(ctx, [dirty]) {
if (!video_updating && dirty & 1 && !isNaN(ctx[0])) {
if (!video_updating && dirty & /* _id9uocqrtmw00_1_ */ 1 && !isNaN(ctx[0])) {
video.currentTime = ctx[0];
}

@ -47,14 +47,14 @@ function create_fragment(ctx) {
append(p, t1);
},
p(ctx, [dirty]) {
if (dirty & 1 && !scrolling) {
if (dirty & /* _id9uocqrtmw00_1_ */ 1 && !scrolling) {
scrolling = true;
clearTimeout(scrolling_timeout);
scrollTo(window.pageXOffset, ctx[0]);
scrolling_timeout = setTimeout(clear_scrolling, 100);
}
if (dirty & 1) set_data(t1, ctx[0]);
if (dirty & /* _id9uocqrtmw00_1_ */ 1) set_data(t1, ctx[0]);
},
i: noop,
o: noop,

Loading…
Cancel
Save