[IMP] compiler: improve generated compiled code

This commit is contained in:
Géry Debongnie
2021-12-22 11:33:12 +01:00
parent d160c4a628
commit e8b0f31da6
36 changed files with 939 additions and 936 deletions
@@ -19,11 +19,11 @@ exports[`t-set slot setted value (with t-set) not accessible with t-esc 1`] = `
ctx = Object.create(ctx);
ctx[isBoundary] = 1
setContextValue(ctx, \\"iter\\", 'source');
let d1 = ctx['iter'];
let txt1 = ctx['iter'];
const ctx1 = capture(ctx);
let b2 = component(\`Childcomp\`, {slots: {'default': {__render: slot2, __ctx: ctx1}}}, key + \`__3\`, node, ctx);
let d2 = ctx['iter'];
return block1([d1, d2], [b2]);
let txt2 = ctx['iter'];
return block1([txt1, txt2], [b2]);
}
}"
`;
@@ -39,10 +39,10 @@ exports[`t-set slot setted value (with t-set) not accessible with t-esc 2`] = `
return function template(ctx, node, key = \\"\\") {
ctx = Object.create(ctx);
ctx[isBoundary] = 1
let d1 = ctx['iter'];
let txt1 = ctx['iter'];
setContextValue(ctx, \\"iter\\", 'called');
let d2 = ctx['iter'];
return block1([d1, d2]);
let txt2 = ctx['iter'];
return block1([txt1, txt2]);
}
}"
`;
@@ -58,10 +58,10 @@ exports[`t-set t-set can't alter component even if key in component 1`] = `
return function template(ctx, node, key = \\"\\") {
ctx = Object.create(ctx);
ctx[isBoundary] = 1
let d1 = ctx['iter'];
let txt1 = ctx['iter'];
setContextValue(ctx, \\"iter\\", 5);
let d2 = ctx['iter'];
return block1([d1, d2]);
let txt2 = ctx['iter'];
return block1([txt1, txt2]);
}
}"
`;
@@ -77,10 +77,10 @@ exports[`t-set t-set can't alter component if key not in component 1`] = `
return function template(ctx, node, key = \\"\\") {
ctx = Object.create(ctx);
ctx[isBoundary] = 1
let d1 = ctx['iter'];
let txt1 = ctx['iter'];
setContextValue(ctx, \\"iter\\", 5);
let d2 = ctx['iter'];
return block1([d1, d2]);
let txt2 = ctx['iter'];
return block1([txt1, txt2]);
}
}"
`;
@@ -104,8 +104,8 @@ exports[`t-set t-set in t-if 1`] = `
} else {
setContextValue(ctx, \\"iter\\", 4);
}
let d1 = ctx['iter'];
return block1([d1]);
let txt1 = ctx['iter'];
return block1([txt1]);
}
}"
`;
@@ -122,10 +122,10 @@ exports[`t-set t-set not altered by child comp 1`] = `
ctx = Object.create(ctx);
ctx[isBoundary] = 1
setContextValue(ctx, \\"iter\\", 'source');
let d1 = ctx['iter'];
let txt1 = ctx['iter'];
let b2 = component(\`Childcomp\`, {}, key + \`__1\`, node, ctx);
let d2 = ctx['iter'];
return block1([d1, d2], [b2]);
let txt2 = ctx['iter'];
return block1([txt1, txt2], [b2]);
}
}"
`;
@@ -141,10 +141,10 @@ exports[`t-set t-set not altered by child comp 2`] = `
return function template(ctx, node, key = \\"\\") {
ctx = Object.create(ctx);
ctx[isBoundary] = 1
let d1 = ctx['iter'];
let txt1 = ctx['iter'];
setContextValue(ctx, \\"iter\\", 'called');
let d2 = ctx['iter'];
return block1([d1, d2]);
let txt2 = ctx['iter'];
return block1([txt1, txt2]);
}
}"
`;
@@ -169,8 +169,8 @@ exports[`t-set t-set outside modified in t-if 1`] = `
} else {
setContextValue(ctx, \\"iter\\", 4);
}
let d1 = ctx['iter'];
return block1([d1]);
let txt1 = ctx['iter'];
return block1([txt1]);
}
}"
`;