mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[REF] compiler: minor cleanup
This commit merges two nested ifs and explicitly joins an array instead of relying on array -> string coercion
This commit is contained in:
committed by
Lucas Perais - lpe@odoo
parent
9823a4e7dd
commit
28672096a2
@@ -34,7 +34,7 @@ exports[`comments properly handle comments between t-if/t-else 1`] = `
|
||||
let block3 = createBlock(\`<span>owl</span>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
let b2,b3;
|
||||
let b2, b3;
|
||||
if (true) {
|
||||
b2 = block2();
|
||||
} else {
|
||||
|
||||
@@ -18,7 +18,7 @@ exports[`misc complex template 1`] = `
|
||||
let block13 = createBlock(\`<i class=\\"fa fa-fw fa-clock-o\\" title=\\"This commit is the head of a base branch\\"/>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
let b2,b3,b4,b6,b8;
|
||||
let b2, b3, b4, b6, b8;
|
||||
let attr1 = \`batch_tile \${ctx['options'].more?'more':'nomore'}\`;
|
||||
let attr2 = \`card bg-\${ctx['klass']}-light\`;
|
||||
let attr3 = \`/runbot/batch/\${ctx['batch'].id}\`;
|
||||
@@ -53,7 +53,7 @@ exports[`misc complex template 1`] = `
|
||||
for (let i1 = 0; i1 < l_block8; i1++) {
|
||||
ctx[\`commit_link\`] = k_block8[i1];
|
||||
const key1 = ctx['commit_link'].id;
|
||||
let b10,b11,b12,b13;
|
||||
let b10, b11, b12, b13;
|
||||
let attr5 = \`/runbot/commit/\${ctx['commit_link'].commit_id}\`;
|
||||
let attr6 = \`badge badge-light batch_commit match_type_\${ctx['commit_link'].match_type}\`;
|
||||
if (ctx['commit_link'].match_type=='new') {
|
||||
@@ -217,7 +217,7 @@ exports[`misc other complex template 1`] = `
|
||||
let block25 = createBlock(\`<div><block-child-0/><block-child-1/></div>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
let b2,b4,b14,b17,b22,b23,b24,b25;
|
||||
let b2, b4, b14, b17, b22, b23, b24, b25;
|
||||
let attr1 = \`/runbot/\${ctx['project'].slug}\`;
|
||||
let txt1 = ctx['project'].name;
|
||||
ctx = Object.create(ctx);
|
||||
@@ -232,12 +232,12 @@ exports[`misc other complex template 1`] = `
|
||||
ctx = ctx.__proto__;
|
||||
b2 = list(c_block2);
|
||||
if (ctx['user']) {
|
||||
let b5,b6;
|
||||
let b5, b6;
|
||||
if (ctx['user'].public) {
|
||||
let attr2 = \`/web/login?redirect=/\`;
|
||||
b5 = block5([attr2]);
|
||||
} else {
|
||||
let b7,b10,b13;
|
||||
let b7, b10, b13;
|
||||
if (ctx['nb_assigned_errors']&&ctx['nb_assigned_errors']>0) {
|
||||
let attr3 = \`You have \${ctx['nb_assigned_errors']} random bug assigned\`;
|
||||
let txt3 = ctx['nb_assigned_errors'];
|
||||
|
||||
@@ -928,7 +928,7 @@ exports[`t-call (template calling) t-call, conditional and t-set in t-call body
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
ctx = Object.create(ctx);
|
||||
ctx[isBoundary] = 1
|
||||
let b2,b3;
|
||||
let b2, b3;
|
||||
setContextValue(ctx, \\"v1\\", 'elif');
|
||||
if (ctx['v1']==='if') {
|
||||
b2 = callTemplate_1.call(this, ctx, node, key + \`__1\`);
|
||||
|
||||
@@ -237,7 +237,7 @@ exports[`t-foreach iterate, position 1`] = `
|
||||
ctx[\`elem_last\`] = i1 === k_block2.length - 1;
|
||||
ctx[\`elem_index\`] = i1;
|
||||
const key1 = ctx['elem'];
|
||||
let b4,b5,b6,b7,b8,b9;
|
||||
let b4, b5, b6, b7, b8, b9;
|
||||
b4 = text(\` -\`);
|
||||
if (ctx['elem_first']) {
|
||||
b5 = text(\` first\`);
|
||||
|
||||
@@ -8,7 +8,7 @@ exports[`t-if a t-if next to a div 1`] = `
|
||||
let block2 = createBlock(\`<div>foo</div>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
let b2,b3;
|
||||
let b2, b3;
|
||||
b2 = block2();
|
||||
if (ctx['cond']) {
|
||||
b3 = text(\`1\`);
|
||||
@@ -44,7 +44,7 @@ exports[`t-if boolean value condition elif (no outside node) 1`] = `
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
let b2,b3,b4,b5;
|
||||
let b2, b3, b4, b5;
|
||||
if (ctx['color']=='black') {
|
||||
b2 = text(\`black pearl\`);
|
||||
} else if (ctx['color']=='yellow') {
|
||||
@@ -67,7 +67,7 @@ exports[`t-if boolean value condition elif 1`] = `
|
||||
let block1 = createBlock(\`<div><block-child-0/><block-child-1/><block-child-2/><block-child-3/></div>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
let b2,b3,b4,b5;
|
||||
let b2, b3, b4, b5;
|
||||
if (ctx['color']=='black') {
|
||||
b2 = text(\`black pearl\`);
|
||||
} else if (ctx['color']=='yellow') {
|
||||
@@ -90,7 +90,7 @@ exports[`t-if boolean value condition else 1`] = `
|
||||
let block1 = createBlock(\`<div><span>begin</span><block-child-0/><block-child-1/><span>end</span></div>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
let b2,b3;
|
||||
let b2, b3;
|
||||
if (ctx['condition']) {
|
||||
b2 = text(\`ok\`);
|
||||
} else {
|
||||
@@ -109,7 +109,7 @@ exports[`t-if boolean value condition false else 1`] = `
|
||||
let block1 = createBlock(\`<div><span>begin</span><block-child-0/><block-child-1/><span>end</span></div>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
let b2,b3;
|
||||
let b2, b3;
|
||||
if (ctx['condition']) {
|
||||
b2 = text(\`fail\`);
|
||||
} else {
|
||||
@@ -145,7 +145,7 @@ exports[`t-if can use some boolean operators in expressions 1`] = `
|
||||
let block1 = createBlock(\`<div><block-child-0/><block-child-1/><block-child-2/><block-child-3/><block-child-4/><block-child-5/><block-child-6/><block-child-7/></div>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
let b2,b3,b4,b5,b6,b7,b8,b9;
|
||||
let b2, b3, b4, b5, b6, b7, b8, b9;
|
||||
if (ctx['cond1']&&ctx['cond2']) {
|
||||
b2 = text(\`and\`);
|
||||
}
|
||||
@@ -239,7 +239,7 @@ exports[`t-if simple t-if/t-else 1`] = `
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
let b2,b3;
|
||||
let b2, b3;
|
||||
if (ctx['condition']) {
|
||||
b2 = text(\`1\`);
|
||||
} else {
|
||||
@@ -258,7 +258,7 @@ exports[`t-if simple t-if/t-else in a div 1`] = `
|
||||
let block1 = createBlock(\`<div><block-child-0/><block-child-1/></div>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
let b2,b3;
|
||||
let b2, b3;
|
||||
if (ctx['condition']) {
|
||||
b2 = text(\`1\`);
|
||||
} else {
|
||||
@@ -277,7 +277,7 @@ exports[`t-if t-esc with t-elif 1`] = `
|
||||
let block1 = createBlock(\`<div><block-child-0/><block-child-1/></div>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
let b2,b3;
|
||||
let b2, b3;
|
||||
if (false) {
|
||||
b2 = text(\`abc\`);
|
||||
} else {
|
||||
@@ -314,7 +314,7 @@ exports[`t-if t-if and t-else with two nodes 1`] = `
|
||||
let block5 = createBlock(\`<span>b</span>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
let b2,b3;
|
||||
let b2, b3;
|
||||
if (ctx['condition']) {
|
||||
b2 = text(\`1\`);
|
||||
} else {
|
||||
@@ -372,7 +372,7 @@ exports[`t-if t-if with empty content 1`] = `
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
let b2,b3;
|
||||
let b2, b3;
|
||||
b2 = text(\`hello\`);
|
||||
if (ctx['condition']) {
|
||||
b3 = text(\`\`);
|
||||
@@ -388,7 +388,7 @@ exports[`t-if t-if/t-else with more content 1`] = `
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
let b2,b3;
|
||||
let b2, b3;
|
||||
if (ctx['condition']) {
|
||||
if (ctx['condition']) {
|
||||
b2 = text(\`asf\`);
|
||||
@@ -458,7 +458,7 @@ exports[`t-if t-set, then t-if, part 3 1`] = `
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
ctx = Object.create(ctx);
|
||||
ctx[isBoundary] = 1
|
||||
let b2,b3;
|
||||
let b2, b3;
|
||||
setContextValue(ctx, \\"y\\", false);
|
||||
setContextValue(ctx, \\"x\\", ctx['y']);
|
||||
if (ctx['x']) {
|
||||
@@ -477,7 +477,7 @@ exports[`t-if two consecutive t-if 1`] = `
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
let b2,b3;
|
||||
let b2, b3;
|
||||
if (ctx['cond1']) {
|
||||
b2 = text(\`1\`);
|
||||
}
|
||||
@@ -497,7 +497,7 @@ exports[`t-if two consecutive t-if in a div 1`] = `
|
||||
let block1 = createBlock(\`<div><block-child-0/><block-child-1/></div>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
let b2,b3;
|
||||
let b2, b3;
|
||||
if (ctx['cond1']) {
|
||||
b2 = text(\`1\`);
|
||||
}
|
||||
@@ -520,7 +520,7 @@ exports[`t-if two t-ifs next to each other 1`] = `
|
||||
let block5 = createBlock(\`<p>2</p>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
let b2,b3;
|
||||
let b2, b3;
|
||||
if (ctx['condition']) {
|
||||
let txt1 = ctx['text'];
|
||||
b2 = block2([txt1]);
|
||||
|
||||
@@ -79,7 +79,7 @@ exports[`t-key t-key on sub dom node pushes a child block in its parent 1`] = `
|
||||
let block3 = createBlock(\`<div><h1/></div>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
let b2,b3;
|
||||
let b2, b3;
|
||||
if (ctx['hasSpan']) {
|
||||
b2 = block2();
|
||||
}
|
||||
|
||||
@@ -309,7 +309,7 @@ exports[`t-out t-out switch markup on bdom 1`] = `
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
ctx = Object.create(ctx);
|
||||
ctx[isBoundary] = 1
|
||||
let b3,b5;
|
||||
let b3, b5;
|
||||
ctx[\`bdom\`] = new LazyValue(value1, ctx, this, node, key);
|
||||
if (ctx['hasBdom']) {
|
||||
const b4 = safeOutput(ctx['bdom']);
|
||||
|
||||
@@ -94,7 +94,7 @@ exports[`t-set set from body literal (with t-if/t-else 1`] = `
|
||||
let { isBoundary, withDefault, LazyValue } = helpers;
|
||||
|
||||
function value1(ctx, node, key = \\"\\") {
|
||||
let b2,b3;
|
||||
let b2, b3;
|
||||
if (ctx['condition']) {
|
||||
b2 = text(\`true\`);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user