Add test for const field binding

pull/4506/head
Michal Vlasák 6 years ago
parent 49d9a28a9f
commit 3bf522cdf2

@ -73,7 +73,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 (!variable.writable) component.error(this.expression.node, { if (info.expression.type === 'Identifier' && !variable.writable) component.error(this.expression.node, {
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',
}); });

@ -0,0 +1,7 @@
<script>
const dummy = {
foo: 'bar'
};
</script>
<input bind:value={dummy.foo}>
Loading…
Cancel
Save