Merge pull request #439 from sveltejs/gh-437

better error for bind:value="{{foo}}"
pull/443/head
Rich Harris 8 years ago committed by GitHub
commit 949dcc5636

@ -77,6 +77,17 @@ export function readBindingDirective ( parser, start, name ) {
const a = parser.index;
if ( parser.eat( '{{' ) ) {
let message = 'bound values should not be wrapped';
const b = parser.template.indexOf( '}}', a );
if ( b !== -1 ) {
const value = parser.template.slice( parser.index, b );
message += ` — use '${value}', not '{{${value}}}'`;
}
parser.error( message, a );
}
// this is a bit of a hack so that we can give Acorn something parseable
let b;
if ( quoteMark ) {

@ -0,0 +1,8 @@
{
"message": "bound values should not be wrapped — use 'foo', not '{{foo}}'",
"loc": {
"line": 1,
"column": 19
},
"pos": 19
}
Loading…
Cancel
Save