From 1ac349fdc613624000ebcf127e4eca171351de69 Mon Sep 17 00:00:00 2001 From: bluwy Date: Mon, 24 Jan 2022 13:34:05 +0800 Subject: [PATCH] remove has_arg --- src/compiler/compile/nodes/Binding.ts | 3 --- .../compile/render_dom/wrappers/Element/Binding.ts | 3 --- .../compile/render_dom/wrappers/Element/index.ts | 12 ------------ 3 files changed, 18 deletions(-) diff --git a/src/compiler/compile/nodes/Binding.ts b/src/compiler/compile/nodes/Binding.ts index 14c44a3985..9e22179f39 100644 --- a/src/compiler/compile/nodes/Binding.ts +++ b/src/compiler/compile/nodes/Binding.ts @@ -31,7 +31,6 @@ export default class Binding extends Node { raw_expression: ESTreeNode; // TODO exists only for bind:this — is there a more elegant solution? is_contextual: boolean; is_readonly: boolean; - has_arg: boolean; constructor(component: Component, parent: Element | InlineComponent | Window, scope: TemplateScope, info: TemplateNode) { super(component, parent, scope, info); @@ -91,8 +90,6 @@ export default class Binding extends Node { (isElement(parent) && ((parent.is_media_node() && read_only_media_attributes.has(this.name)) || (parent.name === 'input' && type === 'file')) /* TODO others? */); - - this.has_arg = sizing.test(this.name); } is_readonly_media_attribute() { diff --git a/src/compiler/compile/render_dom/wrappers/Element/Binding.ts b/src/compiler/compile/render_dom/wrappers/Element/Binding.ts index c60b76a29f..8c348ecc1f 100644 --- a/src/compiler/compile/render_dom/wrappers/Element/Binding.ts +++ b/src/compiler/compile/render_dom/wrappers/Element/Binding.ts @@ -26,7 +26,6 @@ export default class BindingWrapper { }; snippet: Node; is_readonly: boolean; - has_arg: boolean; needs_lock: boolean; constructor(block: Block, node: Binding, parent: ElementWrapper | InlineComponentWrapper) { @@ -54,8 +53,6 @@ export default class BindingWrapper { this.is_readonly = this.node.is_readonly; - this.has_arg = this.node.has_arg; - this.needs_lock = this.node.name === 'currentTime'; // TODO others? } diff --git a/src/compiler/compile/render_dom/wrappers/Element/index.ts b/src/compiler/compile/render_dom/wrappers/Element/index.ts index 42a6de7b7a..d26fb6b3b7 100644 --- a/src/compiler/compile/render_dom/wrappers/Element/index.ts +++ b/src/compiler/compile/render_dom/wrappers/Element/index.ts @@ -487,7 +487,6 @@ export default class ElementWrapper extends Wrapper { block.add_variable(animation_frame); } - const has_arg = binding_group.bindings[0].has_arg; const has_local_function = contextual_dependencies.size > 0 || needs_lock || animation_frame; let callee = renderer.reference(handler); @@ -508,13 +507,6 @@ export default class ElementWrapper extends Wrapper { ${callee}.call(${this.var}, ${args}); } `); - } else if (has_arg) { - block.chunks.init.push(b` - function ${handler}(arg) { - ${needs_lock && b`${lock} = true;`} - ${callee}.call(${this.var}, arg, ${args}); - } - `); } else { block.chunks.init.push(b` function ${handler}() { @@ -532,10 +524,6 @@ export default class ElementWrapper extends Wrapper { name })); - if (has_arg) { - params.unshift({ type: 'Identifier', name: 'arg' }); - } - this.renderer.component.partly_hoisted.push(b` function ${handler}(${params}) { ${binding_group.bindings.map(b => b.handler.mutation)}