mirror of
https://github.com/swc-project/swc.git
synced 2024-12-23 05:32:09 +03:00
refactor(es/parser): Simplify logic (#4329)
This commit is contained in:
parent
ed2674f106
commit
37aec5b199
@ -909,7 +909,13 @@ impl<I: Tokens> Parser<I> {
|
||||
}
|
||||
|
||||
let check_type = ty;
|
||||
let extends_type = p.parse_ts_non_conditional_type_within_ctx()?;
|
||||
let extends_type = {
|
||||
p.with_ctx(Context {
|
||||
disallow_conditional_types: true,
|
||||
..p.ctx()
|
||||
})
|
||||
.parse_ts_non_conditional_type()?
|
||||
};
|
||||
|
||||
expect!(p, '?');
|
||||
|
||||
@ -929,14 +935,6 @@ impl<I: Tokens> Parser<I> {
|
||||
})
|
||||
}
|
||||
|
||||
fn parse_ts_non_conditional_type_within_ctx(&mut self) -> PResult<Box<TsType>> {
|
||||
self.with_ctx(Context {
|
||||
disallow_conditional_types: true,
|
||||
..self.ctx()
|
||||
})
|
||||
.parse_ts_non_conditional_type()
|
||||
}
|
||||
|
||||
/// `tsParseNonConditionalType`
|
||||
fn parse_ts_non_conditional_type(&mut self) -> PResult<Box<TsType>> {
|
||||
trace_cur!(self, parse_ts_non_conditional_type);
|
||||
|
Loading…
Reference in New Issue
Block a user