mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[IMP] qweb: turn handlers into function expressions only
For the sake of consistency with vanilla JS, and to allow some things that were previously not possible.
This commit is contained in:
committed by
Géry Debongnie
parent
d60a5a414e
commit
e611c20ab4
@@ -24,7 +24,7 @@ exports[`t-call (template calling) basic caller 2`] = `
|
||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
let b2 = callTemplate_2(ctx, node, key + \`__1\`);
|
||||
let b2 = callTemplate_2.call(this, ctx, node, key + \`__1\`);
|
||||
return block1([], [b2]);
|
||||
}
|
||||
}"
|
||||
@@ -52,7 +52,7 @@ exports[`t-call (template calling) basic caller, no parent node 2`] = `
|
||||
const callTemplate_2 = getTemplate(\`_basic-callee\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
return callTemplate_2(ctx, node, key + \`__1\`);
|
||||
return callTemplate_2.call(this, ctx, node, key + \`__1\`);
|
||||
}
|
||||
}"
|
||||
`;
|
||||
@@ -91,7 +91,7 @@ exports[`t-call (template calling) call with several sub nodes on same line 2`]
|
||||
let b5 = block5();
|
||||
let b2 = multi([b3, b4, b5]);
|
||||
ctx[zero] = b2;
|
||||
let b6 = callTemplate_2(ctx, node, key + \`__1\`);
|
||||
let b6 = callTemplate_2.call(this, ctx, node, key + \`__1\`);
|
||||
return block1([], [b6]);
|
||||
}
|
||||
}"
|
||||
@@ -129,7 +129,7 @@ exports[`t-call (template calling) cascading t-call t-raw='0' 2`] = `
|
||||
let b4 = html(ctx[zero]);
|
||||
let b2 = multi([b3, b4]);
|
||||
ctx[zero] = b2;
|
||||
let b5 = callTemplate_2(ctx, node, key + \`__1\`);
|
||||
let b5 = callTemplate_2.call(this, ctx, node, key + \`__1\`);
|
||||
return block1([], [b5]);
|
||||
}
|
||||
}"
|
||||
@@ -152,7 +152,7 @@ exports[`t-call (template calling) cascading t-call t-raw='0' 3`] = `
|
||||
let b4 = html(ctx[zero]);
|
||||
let b2 = multi([b3, b4]);
|
||||
ctx[zero] = b2;
|
||||
let b5 = callTemplate_2(ctx, node, key + \`__1\`);
|
||||
let b5 = callTemplate_2.call(this, ctx, node, key + \`__1\`);
|
||||
return block1([], [b5]);
|
||||
}
|
||||
}"
|
||||
@@ -177,7 +177,7 @@ exports[`t-call (template calling) cascading t-call t-raw='0' 4`] = `
|
||||
let b5 = block5();
|
||||
let b2 = multi([b3, b4, b5]);
|
||||
ctx[zero] = b2;
|
||||
let b6 = callTemplate_2(ctx, node, key + \`__1\`);
|
||||
let b6 = callTemplate_2.call(this, ctx, node, key + \`__1\`);
|
||||
return block1([], [b6]);
|
||||
}
|
||||
}"
|
||||
@@ -215,7 +215,7 @@ exports[`t-call (template calling) cascading t-call t-raw='0', without external
|
||||
let b3 = html(ctx[zero]);
|
||||
let b1 = multi([b2, b3]);
|
||||
ctx[zero] = b1;
|
||||
return callTemplate_2(ctx, node, key + \`__1\`);
|
||||
return callTemplate_2.call(this, ctx, node, key + \`__1\`);
|
||||
}
|
||||
}"
|
||||
`;
|
||||
@@ -236,7 +236,7 @@ exports[`t-call (template calling) cascading t-call t-raw='0', without external
|
||||
let b3 = html(ctx[zero]);
|
||||
let b1 = multi([b2, b3]);
|
||||
ctx[zero] = b1;
|
||||
return callTemplate_2(ctx, node, key + \`__1\`);
|
||||
return callTemplate_2.call(this, ctx, node, key + \`__1\`);
|
||||
}
|
||||
}"
|
||||
`;
|
||||
@@ -259,7 +259,7 @@ exports[`t-call (template calling) cascading t-call t-raw='0', without external
|
||||
let b4 = block4();
|
||||
let b1 = multi([b2, b3, b4]);
|
||||
ctx[zero] = b1;
|
||||
return callTemplate_2(ctx, node, key + \`__1\`);
|
||||
return callTemplate_2.call(this, ctx, node, key + \`__1\`);
|
||||
}
|
||||
}"
|
||||
`;
|
||||
@@ -335,7 +335,7 @@ exports[`t-call (template calling) inherit context 2`] = `
|
||||
ctx = Object.create(ctx);
|
||||
ctx[isBoundary] = 1
|
||||
setContextValue(ctx, \\"foo\\", 1);
|
||||
let b2 = callTemplate_2(ctx, node, key + \`__1\`);
|
||||
let b2 = callTemplate_2.call(this, ctx, node, key + \`__1\`);
|
||||
return block1([], [b2]);
|
||||
}
|
||||
}"
|
||||
@@ -353,7 +353,7 @@ exports[`t-call (template calling) recursive template, part 1 1`] = `
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
let b2;
|
||||
if (false) {
|
||||
b2 = callTemplate_2(ctx, node, key + \`__1\`);
|
||||
b2 = callTemplate_2.call(this, ctx, node, key + \`__1\`);
|
||||
}
|
||||
return block1([], [b2]);
|
||||
}
|
||||
@@ -375,7 +375,7 @@ exports[`t-call (template calling) recursive template, part 2 1`] = `
|
||||
ctx = Object.create(ctx);
|
||||
ctx[isBoundary] = 1;
|
||||
setContextValue(ctx, \\"node\\", ctx['root']);
|
||||
let b2 = callTemplate_2(ctx, node, key + \`__1\`);
|
||||
let b2 = callTemplate_2.call(this, ctx, node, key + \`__1\`);
|
||||
return block1([], [b2]);
|
||||
}
|
||||
}"
|
||||
@@ -406,7 +406,7 @@ exports[`t-call (template calling) recursive template, part 2 2`] = `
|
||||
ctx = Object.create(ctx);
|
||||
ctx[isBoundary] = 1;
|
||||
setContextValue(ctx, \\"node\\", ctx['subtree']);
|
||||
c_block2[i1] = withKey(callTemplate_2(ctx, node, key + \`__1__\${key1}\`), key1);
|
||||
c_block2[i1] = withKey(callTemplate_2.call(this, ctx, node, key + \`__1__\${key1}\`), key1);
|
||||
ctx = ctx.__proto__;
|
||||
}
|
||||
let b2 = list(c_block2);
|
||||
@@ -430,7 +430,7 @@ exports[`t-call (template calling) recursive template, part 3 1`] = `
|
||||
ctx = Object.create(ctx);
|
||||
ctx[isBoundary] = 1;
|
||||
setContextValue(ctx, \\"node\\", ctx['root']);
|
||||
let b2 = callTemplate_2(ctx, node, key + \`__1\`);
|
||||
let b2 = callTemplate_2.call(this, ctx, node, key + \`__1\`);
|
||||
return block1([], [b2]);
|
||||
}
|
||||
}"
|
||||
@@ -461,7 +461,7 @@ exports[`t-call (template calling) recursive template, part 3 2`] = `
|
||||
ctx = Object.create(ctx);
|
||||
ctx[isBoundary] = 1;
|
||||
setContextValue(ctx, \\"node\\", ctx['subtree']);
|
||||
c_block2[i1] = withKey(callTemplate_2(ctx, node, key + \`__1__\${key1}\`), key1);
|
||||
c_block2[i1] = withKey(callTemplate_2.call(this, ctx, node, key + \`__1__\${key1}\`), key1);
|
||||
ctx = ctx.__proto__;
|
||||
}
|
||||
let b2 = list(c_block2);
|
||||
@@ -486,7 +486,7 @@ exports[`t-call (template calling) recursive template, part 4: with t-set recurs
|
||||
ctx[isBoundary] = 1;
|
||||
setContextValue(ctx, \\"recursive_idx\\", 1);
|
||||
setContextValue(ctx, \\"node\\", ctx['root']);
|
||||
let b2 = callTemplate_2(ctx, node, key + \`__1\`);
|
||||
let b2 = callTemplate_2.call(this, ctx, node, key + \`__1\`);
|
||||
return block1([], [b2]);
|
||||
}
|
||||
}"
|
||||
@@ -519,7 +519,7 @@ exports[`t-call (template calling) recursive template, part 4: with t-set recurs
|
||||
ctx = Object.create(ctx);
|
||||
ctx[isBoundary] = 1;
|
||||
setContextValue(ctx, \\"node\\", ctx['subtree']);
|
||||
c_block2[i1] = withKey(callTemplate_2(ctx, node, key + \`__1__\${key1}\`), key1);
|
||||
c_block2[i1] = withKey(callTemplate_2.call(this, ctx, node, key + \`__1__\${key1}\`), key1);
|
||||
ctx = ctx.__proto__;
|
||||
}
|
||||
let b2 = list(c_block2);
|
||||
@@ -555,7 +555,7 @@ exports[`t-call (template calling) scoped parameters 2`] = `
|
||||
ctx = Object.create(ctx);
|
||||
ctx[isBoundary] = 1;
|
||||
setContextValue(ctx, \\"foo\\", 42);
|
||||
let b2 = callTemplate_2(ctx, node, key + \`__1\`);
|
||||
let b2 = callTemplate_2.call(this, ctx, node, key + \`__1\`);
|
||||
ctx = ctx.__proto__;
|
||||
let d1 = ctx['foo'];
|
||||
return block1([d1], [b2]);
|
||||
@@ -591,7 +591,7 @@ exports[`t-call (template calling) scoped parameters, part 2 2`] = `
|
||||
ctx = Object.create(ctx);
|
||||
ctx[isBoundary] = 1;
|
||||
setContextValue(ctx, \\"foo\\", 42);
|
||||
let b2 = callTemplate_2(ctx, node, key + \`__1\`);
|
||||
let b2 = callTemplate_2.call(this, ctx, node, key + \`__1\`);
|
||||
ctx = ctx.__proto__;
|
||||
let d1 = ctx['foo'];
|
||||
return block1([d1], [b2]);
|
||||
@@ -609,7 +609,7 @@ exports[`t-call (template calling) t-call allowed on a non t node 1`] = `
|
||||
let block1 = createBlock(\`<div><block-child-0/></div>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
let b2 = callTemplate_2(ctx, node, key + \`__1\`);
|
||||
let b2 = callTemplate_2.call(this, ctx, node, key + \`__1\`);
|
||||
return block1([], [b2]);
|
||||
}
|
||||
}"
|
||||
@@ -658,7 +658,7 @@ exports[`t-call (template calling) t-call with body content as root of a templat
|
||||
ctx[isBoundary] = 1;
|
||||
let b1 = block1();
|
||||
ctx[zero] = b1;
|
||||
return callTemplate_2(ctx, node, key + \`__1\`);
|
||||
return callTemplate_2.call(this, ctx, node, key + \`__1\`);
|
||||
}
|
||||
}"
|
||||
`;
|
||||
@@ -675,7 +675,7 @@ exports[`t-call (template calling) t-call with t-if 1`] = `
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
let b2;
|
||||
if (ctx['flag']) {
|
||||
b2 = callTemplate_2(ctx, node, key + \`__1\`);
|
||||
b2 = callTemplate_2.call(this, ctx, node, key + \`__1\`);
|
||||
}
|
||||
return block1([], [b2]);
|
||||
}
|
||||
@@ -711,7 +711,7 @@ exports[`t-call (template calling) t-call with t-set inside and body text conten
|
||||
ctx = Object.create(ctx);
|
||||
ctx[isBoundary] = 1;
|
||||
setContextValue(ctx, \\"val\\", \`yip yip\`);
|
||||
let b2 = callTemplate_2(ctx, node, key + \`__1\`);
|
||||
let b2 = callTemplate_2.call(this, ctx, node, key + \`__1\`);
|
||||
return block1([], [b2]);
|
||||
}
|
||||
}"
|
||||
@@ -757,7 +757,7 @@ exports[`t-call (template calling) t-call with t-set inside and outside 1`] = `
|
||||
ctx = Object.create(ctx);
|
||||
ctx[isBoundary] = 1;
|
||||
setContextValue(ctx, \\"val3\\", ctx['val']*3);
|
||||
c_block2[i1] = withKey(callTemplate_2(ctx, node, key + \`__1__\${key1}\`), key1);
|
||||
c_block2[i1] = withKey(callTemplate_2.call(this, ctx, node, key + \`__1__\${key1}\`), key1);
|
||||
ctx = ctx.__proto__;
|
||||
}
|
||||
let b2 = list(c_block2);
|
||||
@@ -806,7 +806,7 @@ exports[`t-call (template calling) t-call with t-set inside and outside. 2 1`] =
|
||||
ctx = Object.create(ctx);
|
||||
ctx[isBoundary] = 1;
|
||||
setContextValue(ctx, \\"val3\\", ctx['val']*3);
|
||||
c_block2[i1] = withKey(callTemplate_2(ctx, node, key + \`__1__\${key1}\`), key1);
|
||||
c_block2[i1] = withKey(callTemplate_2.call(this, ctx, node, key + \`__1__\${key1}\`), key1);
|
||||
ctx = ctx.__proto__;
|
||||
}
|
||||
let b2 = list(c_block2);
|
||||
@@ -845,7 +845,7 @@ exports[`t-call (template calling) t-call with t-set inside and outside. 2 3`] =
|
||||
ctx = Object.create(ctx);
|
||||
ctx[isBoundary] = 1
|
||||
setContextValue(ctx, \\"w\\", 'fromwrapper');
|
||||
let b2 = callTemplate_2(ctx, node, key + \`__1\`);
|
||||
let b2 = callTemplate_2.call(this, ctx, node, key + \`__1\`);
|
||||
return block1([], [b2]);
|
||||
}
|
||||
}"
|
||||
@@ -896,12 +896,12 @@ exports[`t-call (template calling) t-call, conditional and t-set in t-call body
|
||||
let b2,b3;
|
||||
setContextValue(ctx, \\"v1\\", 'elif');
|
||||
if (ctx['v1']==='if') {
|
||||
b2 = callTemplate_2(ctx, node, key + \`__1\`);
|
||||
b2 = callTemplate_2.call(this, ctx, node, key + \`__1\`);
|
||||
} else if (ctx['v1']==='elif') {
|
||||
ctx = Object.create(ctx);
|
||||
ctx[isBoundary] = 1;
|
||||
setContextValue(ctx, \\"v\\", 'success');
|
||||
b3 = callTemplate_4(ctx, node, key + \`__3\`);
|
||||
b3 = callTemplate_4.call(this, ctx, node, key + \`__3\`);
|
||||
ctx = ctx.__proto__;
|
||||
}
|
||||
return block1([], [b2, b3]);
|
||||
@@ -922,7 +922,7 @@ exports[`t-call (template calling) t-esc inside t-call, with t-set outside 1`] =
|
||||
ctx = Object.create(ctx);
|
||||
ctx[isBoundary] = 1
|
||||
setContextValue(ctx, \\"v\\", \`Hi\`);
|
||||
let b2 = callTemplate_2(ctx, node, key + \`__1\`);
|
||||
let b2 = callTemplate_2.call(this, ctx, node, key + \`__1\`);
|
||||
return block1([], [b2]);
|
||||
}
|
||||
}"
|
||||
@@ -969,7 +969,7 @@ exports[`t-call (template calling) with unused body 2`] = `
|
||||
ctx[isBoundary] = 1;
|
||||
let b1 = text(\`WHEEE\`);
|
||||
ctx[zero] = b1;
|
||||
return callTemplate_2(ctx, node, key + \`__1\`);
|
||||
return callTemplate_2.call(this, ctx, node, key + \`__1\`);
|
||||
}
|
||||
}"
|
||||
`;
|
||||
@@ -1001,7 +1001,7 @@ exports[`t-call (template calling) with unused setbody 2`] = `
|
||||
ctx = Object.create(ctx);
|
||||
ctx[isBoundary] = 1;
|
||||
setContextValue(ctx, \\"qux\\", 3);
|
||||
return callTemplate_2(ctx, node, key + \`__1\`);
|
||||
return callTemplate_2.call(this, ctx, node, key + \`__1\`);
|
||||
}
|
||||
}"
|
||||
`;
|
||||
@@ -1033,7 +1033,7 @@ exports[`t-call (template calling) with used body 2`] = `
|
||||
ctx[isBoundary] = 1;
|
||||
let b1 = text(\`ok\`);
|
||||
ctx[zero] = b1;
|
||||
return callTemplate_2(ctx, node, key + \`__1\`);
|
||||
return callTemplate_2.call(this, ctx, node, key + \`__1\`);
|
||||
}
|
||||
}"
|
||||
`;
|
||||
@@ -1065,7 +1065,7 @@ exports[`t-call (template calling) with used setbody 2`] = `
|
||||
ctx = Object.create(ctx);
|
||||
ctx[isBoundary] = 1;
|
||||
setContextValue(ctx, \\"foo\\", 'ok');
|
||||
let b2 = callTemplate_2(ctx, node, key + \`__1\`);
|
||||
let b2 = callTemplate_2.call(this, ctx, node, key + \`__1\`);
|
||||
return block1([], [b2]);
|
||||
}
|
||||
}"
|
||||
|
||||
Reference in New Issue
Block a user