Add check for binding non-writable variables

pull/4506/head
Michal Vlasák 6 years ago
parent 926a2aebd8
commit 912c8bad38

@ -72,6 +72,11 @@ 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 (!variable.writable) component.error(this.expression.node, {
code: 'invalid-binding',
message: 'Cannot bind to a variable which is not writable',
});
} }
const type = parent.get_static_attribute_value('type'); const type = parent.get_static_attribute_value('type');

Loading…
Cancel
Save