mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[IMP] compiler: improve generated compiled code
This commit is contained in:
committed by
Aaron Bohy
parent
bd5637c0a3
commit
c7af885f43
@@ -8,10 +8,10 @@ exports[`event handling handler receive the event as argument 1`] = `
|
||||
let block1 = createBlock(\`<span block-handler-0=\\"click\\"><block-child-0/><block-text-1/></span>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
let d1 = [ctx['inc'], ctx];
|
||||
let hdlr1 = [ctx['inc'], ctx];
|
||||
let b2 = component(\`Child\`, {}, key + \`__1\`, node, ctx);
|
||||
let d2 = ctx['state'].value;
|
||||
return block1([d1, d2], [b2]);
|
||||
let txt2 = ctx['state'].value;
|
||||
return block1([hdlr1, txt2], [b2]);
|
||||
}
|
||||
}"
|
||||
`;
|
||||
@@ -46,8 +46,8 @@ exports[`event handling objects from scope are properly captured by t-on 1`] = `
|
||||
let key1 = ctx['item'];
|
||||
const v1 = ctx['onClick'];
|
||||
const v2 = ctx['item'];
|
||||
let d1 = [ev=>v1(v2.val,ev), ctx];
|
||||
c_block2[i1] = withKey(block3([d1]), key1);
|
||||
let hdlr1 = [ev=>v1(v2.val,ev), ctx];
|
||||
c_block2[i1] = withKey(block3([hdlr1]), key1);
|
||||
}
|
||||
let b2 = list(c_block2);
|
||||
return block1([], [b2]);
|
||||
@@ -63,9 +63,9 @@ exports[`event handling support for callable expression in event handler 1`] = `
|
||||
let block1 = createBlock(\`<div><block-text-0/><input type=\\"text\\" block-handler-1=\\"input\\"/></div>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
let d1 = ctx['state'].value;
|
||||
let d2 = [ctx['obj'].onInput, ctx];
|
||||
return block1([d1, d2]);
|
||||
let txt1 = ctx['state'].value;
|
||||
let hdlr2 = [ctx['obj'].onInput, ctx];
|
||||
return block1([txt1, hdlr2]);
|
||||
}
|
||||
}"
|
||||
`;
|
||||
@@ -87,8 +87,8 @@ exports[`event handling t-on with handler bound to dynamic argument on a t-forea
|
||||
let key1 = ctx['item'];
|
||||
const v1 = ctx['onClick'];
|
||||
const v2 = ctx['item'];
|
||||
let d1 = [ev=>v1(v2,ev), ctx];
|
||||
c_block2[i1] = withKey(block3([d1]), key1);
|
||||
let hdlr1 = [ev=>v1(v2,ev), ctx];
|
||||
c_block2[i1] = withKey(block3([hdlr1]), key1);
|
||||
}
|
||||
let b2 = list(c_block2);
|
||||
return block1([], [b2]);
|
||||
|
||||
Reference in New Issue
Block a user