pull/1348/head
Rich Harris 7 years ago
parent 39ad124c99
commit 8eb4adc7e6

@ -30,14 +30,14 @@ export default function computed(validator: Validator, prop: Node) {
if (!isValidIdentifier(name)) {
const suggestion = name.replace(/[^_$a-z0-9]/ig, '_').replace(/^\d/, '_$&');
validator.error(computation, {
validator.error(computation.key, {
code: `invalid-computed-name`,
message: `Computed property name '${name}' is invalid — must be a valid identifier such as ${suggestion}`
});
}
if (reservedNames.has(name)) {
validator.error(computation, {
validator.error(computation.key, {
code: `invalid-computed-name`,
message: `Computed property name '${name}' is invalid — cannot be a JavaScript reserved word`
});

Loading…
Cancel
Save