fix: throw on invalid `{@tag}`s (#17256)

* fix: throw on invalid `{@tag}`s

* fix
pull/17257/head
ComputerGuy 2 months ago committed by GitHub
parent ae6004657d
commit bec7ca7918
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: throw on invalid `{@tag}`s

@ -525,6 +525,12 @@ Expected an identifier
Expected identifier or destructure pattern
```
### expected_tag
```
Expected 'html', 'render', 'attach', 'const', or 'debug'
```
### expected_token
```

@ -223,6 +223,10 @@ The same applies to components:
> Expected identifier or destructure pattern
## expected_tag
> Expected 'html', 'render', 'attach', 'const', or 'debug'
## expected_token
> Expected token %token%

@ -1129,6 +1129,15 @@ export function expected_pattern(node) {
e(node, 'expected_pattern', `Expected identifier or destructure pattern\nhttps://svelte.dev/e/expected_pattern`);
}
/**
* Expected 'html', 'render', 'attach', 'const', or 'debug'
* @param {null | number | NodeLike} node
* @returns {never}
*/
export function expected_tag(node) {
e(node, 'expected_tag', `Expected 'html', 'render', 'attach', 'const', or 'debug'\nhttps://svelte.dev/e/expected_tag`);
}
/**
* Expected token %token%
* @param {null | number | NodeLike} node

@ -724,6 +724,7 @@ function special(parser) {
expression: new ExpressionMetadata()
}
});
return;
}
if (parser.eat('render')) {
@ -755,5 +756,7 @@ function special(parser) {
snippets: new Set()
}
});
return;
}
e.expected_tag(parser.index);
}

Loading…
Cancel
Save