broke tests

pull/5755/head
Andreas Ehrencrona 5 years ago
parent 835c7da7ad
commit 823e138866

@ -72,7 +72,7 @@ export default class Binding extends Node {
const variable = component.var_lookup.get(name); const variable = component.var_lookup.get(name);
if (!variable || variable.global) { if (!variable || variable.global) {
component.error(this, { component.error(this.expression.node as any, {
code: 'binding-undeclared', code: 'binding-undeclared',
message: `${name} is not declared` message: `${name} is not declared`
}); });
@ -81,7 +81,7 @@ export default class Binding extends Node {
variable[this.expression.node.type === 'MemberExpression' ? 'mutated' : 'reassigned'] = true; variable[this.expression.node.type === 'MemberExpression' ? 'mutated' : 'reassigned'] = true;
if (info.expression.type === 'Identifier' && !variable.writable) { if (info.expression.type === 'Identifier' && !variable.writable) {
component.error(this, { component.error(this.expression.node as any, {
code: 'invalid-binding', code: 'invalid-binding',
message: 'Cannot bind to a variable which is not writable' message: 'Cannot bind to a variable which is not writable'
}); });
@ -90,10 +90,6 @@ export default class Binding extends Node {
const type = parent.get_static_attribute_value('type'); const type = parent.get_static_attribute_value('type');
function isElement(node: Node): node is Element {
return !!(node as any).is_media_node;
}
this.is_readonly = this.is_readonly =
dimensions.test(this.name) || dimensions.test(this.name) ||
(isElement(parent) && (isElement(parent) &&
@ -105,3 +101,7 @@ export default class Binding extends Node {
return read_only_media_attributes.has(this.name); return read_only_media_attributes.has(this.name);
} }
} }
function isElement(node: Node): node is Element {
return !!(node as any).is_media_node;
}

Loading…
Cancel
Save