[IMP] compiler: scope generated ids to their prefix

This means that unrelated ids (eg the id of a template, variable or key)
not longer share the same incrementing counter, meaning that you no
longer see a variable named "v2" unless another variable "v1" was
generated previously, this is also true for block data.
This commit is contained in:
Samuel Degueldre
2021-12-22 12:33:17 +01:00
committed by Géry Debongnie
parent e8b0f31da6
commit 34b781aeed
32 changed files with 595 additions and 590 deletions
@@ -24,17 +24,17 @@ exports[`refs refs are properly bound in slots 1`] = `
let block1 = createBlock(\`<div><span class=\\"counter\\"><block-text-0/></span><block-child-0/></div>\`);
let block2 = createBlock(\`<button block-handler-0=\\"click\\" block-ref=\\"1\\">do something</button>\`);
function slot2(ctx, node, key = \\"\\") {
function slot1(ctx, node, key = \\"\\") {
const refs = ctx.__owl__.refs;
let hdlr2 = [ctx['doSomething'], ctx];
let d3 = (el) => refs[\`myButton\`] = el;
return block2([hdlr2, d3]);
let hdlr1 = [ctx['doSomething'], ctx];
let d1 = (el) => refs[\`myButton\`] = el;
return block2([hdlr1, d1]);
}
return function template(ctx, node, key = \\"\\") {
let txt1 = ctx['state'].val;
const ctx1 = capture(ctx);
let b3 = component(\`Dialog\`, {slots: {'footer': {__render: slot2, __ctx: ctx1}}}, key + \`__3\`, node, ctx);
let b3 = component(\`Dialog\`, {slots: {'footer': {__render: slot1, __ctx: ctx1}}}, key + \`__1\`, node, ctx);
return block1([txt1], [b3]);
}
}"