|
|
|
@ -21,7 +21,6 @@ export default function bind_this(component, block, binding, variable) {
|
|
|
|
.map((dep) => b`${block.renderer.invalidate(dep)};`)}
|
|
|
|
.map((dep) => b`${block.renderer.invalidate(dep)};`)}
|
|
|
|
`;
|
|
|
|
`;
|
|
|
|
if (contextual_dependencies.size) {
|
|
|
|
if (contextual_dependencies.size) {
|
|
|
|
|
|
|
|
|
|
|
|
/** @type {import('estree').Identifier[]} */
|
|
|
|
/** @type {import('estree').Identifier[]} */
|
|
|
|
const params = Array.from(contextual_dependencies).map((name) => ({
|
|
|
|
const params = Array.from(contextual_dependencies).map((name) => ({
|
|
|
|
type: 'Identifier',
|
|
|
|
type: 'Identifier',
|
|
|
|
@ -41,8 +40,11 @@ export default function bind_this(component, block, binding, variable) {
|
|
|
|
let found = false;
|
|
|
|
let found = false;
|
|
|
|
if (block.variables.has(id.name)) {
|
|
|
|
if (block.variables.has(id.name)) {
|
|
|
|
let alias = id.name;
|
|
|
|
let alias = id.name;
|
|
|
|
for (let i = 1; block.variables.has(alias) && !compare_node(block.variables.get(alias).init, value); alias = `${id.name}_${i++}`)
|
|
|
|
for (
|
|
|
|
;
|
|
|
|
let i = 1;
|
|
|
|
|
|
|
|
block.variables.has(alias) && !compare_node(block.variables.get(alias).init, value);
|
|
|
|
|
|
|
|
alias = `${id.name}_${i++}`
|
|
|
|
|
|
|
|
);
|
|
|
|
alias_map.set(alias, id.name);
|
|
|
|
alias_map.set(alias, id.name);
|
|
|
|
id = { type: 'Identifier', name: alias };
|
|
|
|
id = { type: 'Identifier', name: alias };
|
|
|
|
found = block.variables.has(alias);
|
|
|
|
found = block.variables.has(alias);
|
|
|
|
@ -59,7 +61,9 @@ export default function bind_this(component, block, binding, variable) {
|
|
|
|
const ${unassign} = () => ${callee}(null, ${args});
|
|
|
|
const ${unassign} = () => ${callee}(null, ${args});
|
|
|
|
`);
|
|
|
|
`);
|
|
|
|
const condition = Array.from(args)
|
|
|
|
const condition = Array.from(args)
|
|
|
|
.map((name) => x `${name} !== ${block.renderer.reference(alias_map.get(name.name) || name.name)}`)
|
|
|
|
.map(
|
|
|
|
|
|
|
|
(name) => x`${name} !== ${block.renderer.reference(alias_map.get(name.name) || name.name)}`
|
|
|
|
|
|
|
|
)
|
|
|
|
.reduce((lhs, rhs) => x`${lhs} || ${rhs}`);
|
|
|
|
.reduce((lhs, rhs) => x`${lhs} || ${rhs}`);
|
|
|
|
// we push unassign and unshift assign so that references are
|
|
|
|
// we push unassign and unshift assign so that references are
|
|
|
|
// nulled out before they're created, to avoid glitches
|
|
|
|
// nulled out before they're created, to avoid glitches
|
|
|
|
@ -83,7 +87,3 @@ export default function bind_this(component, block, binding, variable) {
|
|
|
|
block.chunks.destroy.push(b`${callee}(null);`);
|
|
|
|
block.chunks.destroy.push(b`${callee}(null);`);
|
|
|
|
return b`${callee}(${variable});`;
|
|
|
|
return b`${callee}(${variable});`;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|