mirror of
https://github.com/swc-project/swc.git
synced 2024-11-28 11:13:43 +03:00
feat(es/parser): Enforce orders of override
and async
(#1670)
Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
This commit is contained in:
parent
de15804b89
commit
b713972493
@ -716,7 +716,13 @@ impl<'a, I: Tokens> Parser<I> {
|
||||
{
|
||||
// handle async foo(){}
|
||||
|
||||
let is_override = is_override || self.parse_ts_modifier(&["override"])?.is_some();
|
||||
if self.parse_ts_modifier(&["override"])?.is_some() {
|
||||
is_override = true;
|
||||
self.emit_err(
|
||||
self.input.prev_span(),
|
||||
SyntaxError::TS1029(js_word!("override"), js_word!("async")),
|
||||
);
|
||||
}
|
||||
|
||||
let is_generator = eat!(self, '*');
|
||||
let key = self.parse_class_prop_name()?;
|
||||
|
@ -0,0 +1,3 @@
|
||||
class C extends B {
|
||||
async override fetch() {}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
error: 'override' modifier must precede 'async' modifier.
|
||||
--> $DIR/tests/typescript-errors/class/override-with-async/input.ts:2:9
|
||||
|
|
||||
2 | async override fetch() {}
|
||||
| ^^^^^^^^
|
||||
|
Loading…
Reference in New Issue
Block a user