Lint and format src/compiler/compile/render_dom/wrappers/shared/bind_this.js

pull/8569/head
Simon Holthausen 3 years ago
parent f745d7c75e
commit 00c69ab317

@ -21,7 +21,6 @@ export default function bind_this(component, block, binding, variable) {
.map((dep) => b`${block.renderer.invalidate(dep)};`)}
`;
if (contextual_dependencies.size) {
/** @type {import('estree').Identifier[]} */
const params = Array.from(contextual_dependencies).map((name) => ({
type: 'Identifier',
@ -41,8 +40,11 @@ export default function bind_this(component, block, binding, variable) {
let found = false;
if (block.variables.has(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);
id = { type: 'Identifier', name: 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 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}`);
// we push unassign and unshift assign so that references are
// 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);`);
return b`${callee}(${variable});`;
}

Loading…
Cancel
Save