mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
feat(parser): add syntax error for hyphen in JSXMemberExpression <Foo.bar-baz /> (#5440)
closes #5355
This commit is contained in:
parent
fdb8857630
commit
10279f55d9
3 changed files with 14 additions and 2 deletions
|
|
@ -198,7 +198,12 @@ impl<'a> ParserImpl<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// <foo.bar>
|
// <foo.bar>
|
||||||
property = Some(self.parse_jsx_identifier()?);
|
let ident = self.parse_jsx_identifier()?;
|
||||||
|
// `<foo.bar- />` is a syntax error.
|
||||||
|
if ident.name.contains('-') {
|
||||||
|
return Err(diagnostics::unexpected_token(ident.span));
|
||||||
|
}
|
||||||
|
property = Some(ident);
|
||||||
span = self.end_span(span);
|
span = self.end_span(span);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
1
tasks/coverage/misc/fail/oxc-5355.jsx
Normal file
1
tasks/coverage/misc/fail/oxc-5355.jsx
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
<Foo.bar-baz />
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
parser_misc Summary:
|
parser_misc Summary:
|
||||||
AST Parsed : 27/27 (100.00%)
|
AST Parsed : 27/27 (100.00%)
|
||||||
Positive Passed: 27/27 (100.00%)
|
Positive Passed: 27/27 (100.00%)
|
||||||
Negative Passed: 16/16 (100.00%)
|
Negative Passed: 17/17 (100.00%)
|
||||||
|
|
||||||
× Unexpected token
|
× Unexpected token
|
||||||
╭─[misc/fail/oxc-169.js:2:1]
|
╭─[misc/fail/oxc-169.js:2:1]
|
||||||
|
|
@ -238,6 +238,12 @@ Negative Passed: 16/16 (100.00%)
|
||||||
5 │ }
|
5 │ }
|
||||||
╰────
|
╰────
|
||||||
|
|
||||||
|
× Unexpected token
|
||||||
|
╭─[misc/fail/oxc-5355.jsx:1:6]
|
||||||
|
1 │ <Foo.bar-baz />
|
||||||
|
· ───────
|
||||||
|
╰────
|
||||||
|
|
||||||
× The keyword 'let' is reserved
|
× The keyword 'let' is reserved
|
||||||
╭─[misc/fail/oxc.js:1:1]
|
╭─[misc/fail/oxc.js:1:1]
|
||||||
1 │ let.a = 1;
|
1 │ let.a = 1;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue