From 22fd9c18f17ae4952186134243d260c49b223b96 Mon Sep 17 00:00:00 2001 From: Conduitry Date: Sun, 23 Jun 2019 08:14:46 -0400 Subject: [PATCH] tidy --- .../compile/render-dom/wrappers/InlineComponent/index.ts | 6 ++---- src/compiler/compile/utils/flatten_reference.ts | 1 - 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/compiler/compile/render-dom/wrappers/InlineComponent/index.ts b/src/compiler/compile/render-dom/wrappers/InlineComponent/index.ts index fc2f063c31..46b3df4c31 100644 --- a/src/compiler/compile/render-dom/wrappers/InlineComponent/index.ts +++ b/src/compiler/compile/render-dom/wrappers/InlineComponent/index.ts @@ -277,18 +277,16 @@ export default class InlineComponentWrapper extends Wrapper { } const contextual_dependencies = [...binding.expression.contextual_dependencies]; - const contextual_params = contextual_dependencies.length > 0 ? `, ${contextual_dependencies.join(', ')}` : ''; - const call_site_contextual_params = contextual_dependencies.length > 0 ? `, ${contextual_dependencies.map(name => `ctx.${name}`).join(', ')}` : ''; component.partly_hoisted.push(deindent` - function ${fn}($$component${contextual_params}) { + function ${fn}(${['$$component', ...contextual_dependencies].join(', ')}) { ${lhs} = $$component; ${object && component.invalidate(object)} } `); block.builders.destroy.add_line(`ctx.${fn}(null);`); - return `@add_binding_callback(() => ctx.${fn}(${this.var}${call_site_contextual_params}));`; + return `@add_binding_callback(() => ctx.${fn}(${[this.var, ...contextual_dependencies.map(name => `ctx.${name}`)].join(', ')}));`; } const name = component.get_unique_name(`${this.var}_${binding.name}_binding`); diff --git a/src/compiler/compile/utils/flatten_reference.ts b/src/compiler/compile/utils/flatten_reference.ts index 578f00dcbd..460cd2f1e9 100644 --- a/src/compiler/compile/utils/flatten_reference.ts +++ b/src/compiler/compile/utils/flatten_reference.ts @@ -29,4 +29,3 @@ export default function flatten_reference(node: Node) { return { name, nodes, parts, keypath: `${name}[✂${prop_start}-${prop_end}✂]` }; } - \ No newline at end of file