[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
@@ -20,9 +20,9 @@ exports[`t-on t-on expression captured in t-foreach 1`] = `
let key1 = ctx['val'];
const v1 = ctx['otherState'];
const v2 = ctx['iter'];
let d1 = [()=>v1.vals.push(v2+'_'+v2), ctx];
let hdlr1 = [()=>v1.vals.push(v2+'_'+v2), ctx];
setContextValue(ctx, \\"iter\\", ctx['iter']+1);
c_block2[i1] = withKey(block3([d1]), key1);
c_block2[i1] = withKey(block3([hdlr1]), key1);
}
let b2 = list(c_block2);
return block1([], [b2]);
@@ -46,12 +46,12 @@ exports[`t-on t-on expression in t-foreach 1`] = `
ctx[\`val\`] = v_block2[i1];
ctx[\`val_index\`] = i1;
let key1 = ctx['val'];
let d1 = ctx['val_index'];
let d2 = ctx['val']+'';
let txt1 = ctx['val_index'];
let txt2 = ctx['val']+'';
const v1 = ctx['otherState'];
const v2 = ctx['val'];
let d3 = [()=>v1.vals.push(v2), ctx];
c_block2[i1] = withKey(block3([d1, d2, d3]), key1);
let hdlr3 = [()=>v1.vals.push(v2), ctx];
c_block2[i1] = withKey(block3([txt1, txt2, hdlr3]), key1);
}
let b2 = list(c_block2);
return block1([], [b2]);
@@ -79,13 +79,13 @@ exports[`t-on t-on expression in t-foreach with t-set 1`] = `
ctx[\`val_index\`] = i1;
let key1 = ctx['val'];
setContextValue(ctx, \\"bossa\\", ctx['bossa']+'_'+ctx['val_index']);
let d1 = ctx['val_index'];
let d2 = ctx['val']+'';
let txt1 = ctx['val_index'];
let txt2 = ctx['val']+'';
const v1 = ctx['otherState'];
const v2 = ctx['val'];
const v3 = ctx['bossa'];
let d3 = [()=>v1.vals.push(v2+'_'+v3), ctx];
c_block2[i1] = withKey(block3([d1, d2, d3]), key1);
let hdlr3 = [()=>v1.vals.push(v2+'_'+v3), ctx];
c_block2[i1] = withKey(block3([txt1, txt2, hdlr3]), key1);
}
let b2 = list(c_block2);
return block1([], [b2]);
@@ -109,11 +109,11 @@ exports[`t-on t-on method call in t-foreach 1`] = `
ctx[\`val\`] = v_block2[i1];
ctx[\`val_index\`] = i1;
let key1 = ctx['val'];
let d1 = ctx['val_index'];
let d2 = ctx['val']+'';
let txt1 = ctx['val_index'];
let txt2 = ctx['val']+'';
const v1 = ctx['val'];
let d3 = [()=>this.addVal(v1), ctx];
c_block2[i1] = withKey(block3([d1, d2, d3]), key1);
let hdlr3 = [()=>this.addVal(v1), ctx];
c_block2[i1] = withKey(block3([txt1, txt2, hdlr3]), key1);
}
let b2 = list(c_block2);
return block1([], [b2]);
@@ -146,8 +146,8 @@ exports[`t-on t-on on destroyed components 2`] = `
let block1 = createBlock(\`<div block-handler-0=\\"click\\"/>\`);
return function template(ctx, node, key = \\"\\") {
let d1 = [ctx['onClick'], ctx];
return block1([d1]);
let hdlr1 = [ctx['onClick'], ctx];
return block1([hdlr1]);
}
}"
`;