mirror of https://github.com/sveltejs/svelte
better error for attempts to use getters/setters for methods. closes #425
parent
2e946e0e93
commit
99d6502bfd
@ -0,0 +1,7 @@
|
||||
export default function checkForAccessors ( validator, properties, label ) {
|
||||
properties.forEach( prop => {
|
||||
if ( prop.kind !== 'init' ) {
|
||||
validator.error( `${label} cannot use getters and setters`, prop.start );
|
||||
}
|
||||
});
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
[{
|
||||
"message": "Methods cannot use getters and setters",
|
||||
"loc": {
|
||||
"line": 4,
|
||||
"column": 3
|
||||
},
|
||||
"pos": 43
|
||||
}]
|
@ -0,0 +1,9 @@
|
||||
<script>
|
||||
export default {
|
||||
methods: {
|
||||
get foo () {
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
Loading…
Reference in new issue