remove has_arg

pull/5963/head
bluwy 5 years ago
parent 3317eb3a42
commit 1ac349fdc6

@ -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() {

@ -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?
}

@ -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)}

Loading…
Cancel
Save