[IMP] compiler: improve generated compiled code

This commit is contained in:
Géry Debongnie
2021-12-22 11:33:12 +01:00
committed by Aaron Bohy
parent bd5637c0a3
commit c7af885f43
36 changed files with 939 additions and 936 deletions
+26 -26
View File
@@ -71,8 +71,8 @@ exports[`Reactivity: useState destroyed component before being mounted is inacti
let block1 = createBlock(\`<span><block-text-0/></span>\`);
return function template(ctx, node, key = \\"\\") {
let d1 = ctx['contextObj'].a;
return block1([d1]);
let txt1 = ctx['contextObj'].a;
return block1([txt1]);
}
}"
`;
@@ -102,8 +102,8 @@ exports[`Reactivity: useState destroyed component is inactive 2`] = `
let block1 = createBlock(\`<span><block-text-0/></span>\`);
return function template(ctx, node, key = \\"\\") {
let d1 = ctx['contextObj'].a;
return block1([d1]);
let txt1 = ctx['contextObj'].a;
return block1([txt1]);
}
}"
`;
@@ -116,9 +116,9 @@ exports[`Reactivity: useState one components can subscribe twice to same context
let block1 = createBlock(\`<div><block-text-0/><block-text-1/></div>\`);
return function template(ctx, node, key = \\"\\") {
let d1 = ctx['contextObj1'].a;
let d2 = ctx['contextObj2'].b;
return block1([d1, d2]);
let txt1 = ctx['contextObj1'].a;
let txt2 = ctx['contextObj2'].b;
return block1([txt1, txt2]);
}
}"
`;
@@ -132,8 +132,8 @@ exports[`Reactivity: useState parent and children subscribed to same context 1`]
return function template(ctx, node, key = \\"\\") {
let b2 = component(\`Child\`, {}, key + \`__1\`, node, ctx);
let d1 = ctx['contextObj'].b;
return block1([d1], [b2]);
let txt1 = ctx['contextObj'].b;
return block1([txt1], [b2]);
}
}"
`;
@@ -146,8 +146,8 @@ exports[`Reactivity: useState parent and children subscribed to same context 2`]
let block1 = createBlock(\`<span><block-text-0/></span>\`);
return function template(ctx, node, key = \\"\\") {
let d1 = ctx['contextObj'].a;
return block1([d1]);
let txt1 = ctx['contextObj'].a;
return block1([txt1]);
}
}"
`;
@@ -238,8 +238,8 @@ exports[`Reactivity: useState two components are updated in parallel 2`] = `
let block1 = createBlock(\`<span><block-text-0/></span>\`);
return function template(ctx, node, key = \\"\\") {
let d1 = ctx['contextObj'].value;
return block1([d1]);
let txt1 = ctx['contextObj'].value;
return block1([txt1]);
}
}"
`;
@@ -267,8 +267,8 @@ exports[`Reactivity: useState two components can subscribe to same context 2`] =
let block1 = createBlock(\`<span><block-text-0/></span>\`);
return function template(ctx, node, key = \\"\\") {
let d1 = ctx['contextObj'].value;
return block1([d1]);
let txt1 = ctx['contextObj'].value;
return block1([txt1]);
}
}"
`;
@@ -296,8 +296,8 @@ exports[`Reactivity: useState two independent components on different levels are
let block1 = createBlock(\`<span><block-text-0/></span>\`);
return function template(ctx, node, key = \\"\\") {
let d1 = ctx['contextObj'].value;
return block1([d1]);
let txt1 = ctx['contextObj'].value;
return block1([txt1]);
}
}"
`;
@@ -324,8 +324,8 @@ exports[`Reactivity: useState useContext=useState hook is reactive, for one comp
let block1 = createBlock(\`<div><block-text-0/></div>\`);
return function template(ctx, node, key = \\"\\") {
let d1 = ctx['contextObj'].value;
return block1([d1]);
let txt1 = ctx['contextObj'].value;
return block1([txt1]);
}
}"
`;
@@ -348,9 +348,9 @@ exports[`Reactivity: useState useless atoms should be deleted 1`] = `
}
ctx = ctx.__proto__;
let b2 = list(c_block2);
let d1 = ctx['total'];
let d2 = Object.keys(ctx['state']).length;
return block1([d1, d2], [b2]);
let txt1 = ctx['total'];
let txt2 = Object.keys(ctx['state']).length;
return block1([txt1, txt2], [b2]);
}
}"
`;
@@ -363,8 +363,8 @@ exports[`Reactivity: useState useless atoms should be deleted 2`] = `
let block1 = createBlock(\`<div><block-text-0/></div>\`);
return function template(ctx, node, key = \\"\\") {
let d1 = ctx['state'].quantity;
return block1([d1]);
let txt1 = ctx['state'].quantity;
return block1([txt1]);
}
}"
`;
@@ -377,8 +377,8 @@ exports[`Reactivity: useState very simple use, with initial value 1`] = `
let block1 = createBlock(\`<div><block-text-0/></div>\`);
return function template(ctx, node, key = \\"\\") {
let d1 = ctx['contextObj'].value;
return block1([d1]);
let txt1 = ctx['contextObj'].value;
return block1([txt1]);
}
}"
`;