mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
refactor(parser): use function parse_type_member_semicolon (#7018)
This commit is contained in:
parent
aa1b29c0cf
commit
17a938ee1f
1 changed files with 6 additions and 12 deletions
|
|
@ -1137,8 +1137,7 @@ impl<'a> ParserImpl<'a> {
|
||||||
let type_parameters = self.parse_ts_type_parameters()?;
|
let type_parameters = self.parse_ts_type_parameters()?;
|
||||||
let (this_param, params) = self.parse_formal_parameters(FormalParameterKind::Signature)?;
|
let (this_param, params) = self.parse_formal_parameters(FormalParameterKind::Signature)?;
|
||||||
let return_type = self.parse_ts_return_type_annotation(Kind::Colon, false)?;
|
let return_type = self.parse_ts_return_type_annotation(Kind::Colon, false)?;
|
||||||
self.bump(Kind::Comma);
|
self.parse_type_member_semicolon();
|
||||||
self.bump(Kind::Semicolon);
|
|
||||||
Ok(self.ast.ts_signature_call_signature_declaration(
|
Ok(self.ast.ts_signature_call_signature_declaration(
|
||||||
self.end_span(span),
|
self.end_span(span),
|
||||||
type_parameters,
|
type_parameters,
|
||||||
|
|
@ -1154,8 +1153,7 @@ impl<'a> ParserImpl<'a> {
|
||||||
let (key, computed) = self.parse_property_name()?;
|
let (key, computed) = self.parse_property_name()?;
|
||||||
let (this_param, params) = self.parse_formal_parameters(FormalParameterKind::Signature)?;
|
let (this_param, params) = self.parse_formal_parameters(FormalParameterKind::Signature)?;
|
||||||
let return_type = self.parse_ts_return_type_annotation(Kind::Colon, false)?;
|
let return_type = self.parse_ts_return_type_annotation(Kind::Colon, false)?;
|
||||||
self.bump(Kind::Comma);
|
self.parse_type_member_semicolon();
|
||||||
self.bump(Kind::Semicolon);
|
|
||||||
Ok(self.ast.ts_signature_method_signature(
|
Ok(self.ast.ts_signature_method_signature(
|
||||||
self.end_span(span),
|
self.end_span(span),
|
||||||
key,
|
key,
|
||||||
|
|
@ -1175,8 +1173,7 @@ impl<'a> ParserImpl<'a> {
|
||||||
let (key, computed) = self.parse_property_name()?;
|
let (key, computed) = self.parse_property_name()?;
|
||||||
let (this_param, params) = self.parse_formal_parameters(FormalParameterKind::Signature)?;
|
let (this_param, params) = self.parse_formal_parameters(FormalParameterKind::Signature)?;
|
||||||
let return_type = self.parse_ts_return_type_annotation(Kind::Colon, false)?;
|
let return_type = self.parse_ts_return_type_annotation(Kind::Colon, false)?;
|
||||||
self.bump(Kind::Comma);
|
self.parse_type_member_semicolon();
|
||||||
self.bump(Kind::Semicolon);
|
|
||||||
if let Some(return_type) = return_type.as_ref() {
|
if let Some(return_type) = return_type.as_ref() {
|
||||||
self.error(diagnostics::a_set_accessor_cannot_have_a_return_type_annotation(
|
self.error(diagnostics::a_set_accessor_cannot_have_a_return_type_annotation(
|
||||||
return_type.span,
|
return_type.span,
|
||||||
|
|
@ -1214,8 +1211,7 @@ impl<'a> ParserImpl<'a> {
|
||||||
else {
|
else {
|
||||||
unreachable!()
|
unreachable!()
|
||||||
};
|
};
|
||||||
self.bump(Kind::Comma);
|
self.parse_type_member_semicolon();
|
||||||
self.bump(Kind::Semicolon);
|
|
||||||
let call_signature = call_signature.unbox();
|
let call_signature = call_signature.unbox();
|
||||||
Ok(self.ast.ts_signature_method_signature(
|
Ok(self.ast.ts_signature_method_signature(
|
||||||
self.end_span(span),
|
self.end_span(span),
|
||||||
|
|
@ -1230,8 +1226,7 @@ impl<'a> ParserImpl<'a> {
|
||||||
))
|
))
|
||||||
} else {
|
} else {
|
||||||
let type_annotation = self.parse_ts_type_annotation()?;
|
let type_annotation = self.parse_ts_type_annotation()?;
|
||||||
self.bump(Kind::Comma);
|
self.parse_type_member_semicolon();
|
||||||
self.bump(Kind::Semicolon);
|
|
||||||
Ok(self.ast.ts_signature_property_signature(
|
Ok(self.ast.ts_signature_property_signature(
|
||||||
self.end_span(span),
|
self.end_span(span),
|
||||||
computed,
|
computed,
|
||||||
|
|
@ -1256,8 +1251,7 @@ impl<'a> ParserImpl<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
let return_type = self.parse_ts_return_type_annotation(Kind::Colon, false)?;
|
let return_type = self.parse_ts_return_type_annotation(Kind::Colon, false)?;
|
||||||
self.bump(Kind::Comma);
|
self.parse_type_member_semicolon();
|
||||||
self.bump(Kind::Semicolon);
|
|
||||||
|
|
||||||
Ok(self.ast.ts_signature_construct_signature_declaration(
|
Ok(self.ast.ts_signature_construct_signature_declaration(
|
||||||
self.end_span(span),
|
self.end_span(span),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue