From 4b08fe38f27dd5310d120d79d1a98c95151e1878 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Sun, 28 May 2017 16:12:37 -0400 Subject: [PATCH] change error message for invalid bindings --- src/parse/read/directives.ts | 2 +- test/parser/samples/error-binding-rvalue/error.json | 8 ++++++++ test/parser/samples/error-binding-rvalue/input.html | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 test/parser/samples/error-binding-rvalue/error.json create mode 100644 test/parser/samples/error-binding-rvalue/input.html diff --git a/src/parse/read/directives.ts b/src/parse/read/directives.ts index 7f1a77d669..f4bc5d4f60 100644 --- a/src/parse/read/directives.ts +++ b/src/parse/read/directives.ts @@ -104,7 +104,7 @@ export function readBindingDirective ( parser: Parser, start: number, name: stri value = parseExpressionAt( source, a ); if ( value.type !== 'Identifier' && value.type !== 'MemberExpression' ) { - parser.error( `Expected valid property name` ); + parser.error( `Cannot bind to rvalue`, value.start ); } parser.allowWhitespace(); diff --git a/test/parser/samples/error-binding-rvalue/error.json b/test/parser/samples/error-binding-rvalue/error.json new file mode 100644 index 0000000000..85b4a6f9ac --- /dev/null +++ b/test/parser/samples/error-binding-rvalue/error.json @@ -0,0 +1,8 @@ +{ + "message": "Cannot bind to rvalue", + "pos": 19, + "loc": { + "line": 1, + "column": 19 + } +} \ No newline at end of file diff --git a/test/parser/samples/error-binding-rvalue/input.html b/test/parser/samples/error-binding-rvalue/input.html new file mode 100644 index 0000000000..0b1f716c23 --- /dev/null +++ b/test/parser/samples/error-binding-rvalue/input.html @@ -0,0 +1 @@ + \ No newline at end of file