[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 Aaron Bohy
parent c7af885f43
commit 9f2e2bcc66
32 changed files with 595 additions and 590 deletions
@@ -32,7 +32,7 @@ exports[`t-out multiple calls to t-out 1`] = `
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let { isBoundary, zero, getTemplate } = helpers;
const callTemplate_2 = getTemplate(\`sub\`);
const callTemplate_1 = getTemplate(\`sub\`);
let block1 = createBlock(\`<div><block-child-0/></div>\`);
let block2 = createBlock(\`<span>coucou</span>\`);
@@ -42,7 +42,7 @@ exports[`t-out multiple calls to t-out 1`] = `
ctx[isBoundary] = 1;
let b2 = block2();
ctx[zero] = b2;
let b3 = callTemplate_2.call(this, ctx, node, key + \`__1\`);
let b3 = callTemplate_1.call(this, ctx, node, key + \`__1\`);
return block1([], [b3]);
}
}"
@@ -84,7 +84,7 @@ exports[`t-out t-out 0 1`] = `
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let { isBoundary, zero, getTemplate } = helpers;
const callTemplate_2 = getTemplate(\`_basic-callee\`);
const callTemplate_1 = getTemplate(\`_basic-callee\`);
let block1 = createBlock(\`<div><block-child-0/></div>\`);
let block2 = createBlock(\`<div>zero</div>\`);
@@ -94,7 +94,7 @@ exports[`t-out t-out 0 1`] = `
ctx[isBoundary] = 1;
let b2 = block2();
ctx[zero] = b2;
let b3 = callTemplate_2.call(this, ctx, node, key + \`__1\`);
let b3 = callTemplate_1.call(this, ctx, node, key + \`__1\`);
return block1([], [b3]);
}
}"