deconflict 'value' param in contextual bindings (#4445)

pull/4452/head
Conduitry 6 years ago
parent a972a47e14
commit 400cd1d1ea

@ -332,8 +332,7 @@ export default class InlineComponentWrapper extends Wrapper {
contextual_dependencies.push(object.name, property.name); contextual_dependencies.push(object.name, property.name);
} }
const value = block.get_unique_name('value'); const params: any[] = [x`#value`];
const params: any[] = [value];
if (contextual_dependencies.length > 0) { if (contextual_dependencies.length > 0) {
const args = []; const args = [];
@ -349,23 +348,23 @@ export default class InlineComponentWrapper extends Wrapper {
block.chunks.init.push(b` block.chunks.init.push(b`
function ${id}(${value}) { function ${id}(#value) {
${callee}.call(null, ${value}, ${args}); ${callee}.call(null, #value, ${args});
} }
`); `);
block.maintain_context = true; // TODO put this somewhere more logical block.maintain_context = true; // TODO put this somewhere more logical
} else { } else {
block.chunks.init.push(b` block.chunks.init.push(b`
function ${id}(${value}) { function ${id}(#value) {
${callee}.call(null, ${value}); ${callee}.call(null, #value);
} }
`); `);
} }
const body = b` const body = b`
function ${id}(${params}) { function ${id}(${params}) {
${lhs} = ${value}; ${lhs} = #value;
${renderer.invalidate(dependencies[0])}; ${renderer.invalidate(dependencies[0])};
} }
`; `;

Loading…
Cancel
Save