mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 12:19:15 +00:00
refactor(ast): remove duplicate TSNamedTupleMember representation (#3101)
Removes duplicate representation of a `TSTupleElement` which is a `TSNamedTupleMember`. Closes #3100.
This commit is contained in:
parent
78875b79fe
commit
0185eb2edc
5 changed files with 2 additions and 8 deletions
|
|
@ -299,7 +299,6 @@ pub enum TSTupleElement<'a> {
|
|||
TSType(TSType<'a>),
|
||||
TSOptionalType(Box<'a, TSOptionalType<'a>>),
|
||||
TSRestType(Box<'a, TSRestType<'a>>),
|
||||
TSNamedTupleMember(Box<'a, TSNamedTupleMember<'a>>),
|
||||
}
|
||||
|
||||
#[derive(Debug, Hash)]
|
||||
|
|
|
|||
|
|
@ -2748,7 +2748,6 @@ pub mod walk {
|
|||
TSTupleElement::TSType(ty) => visitor.visit_ts_type(ty),
|
||||
TSTupleElement::TSOptionalType(ty) => visitor.visit_ts_type(&ty.type_annotation),
|
||||
TSTupleElement::TSRestType(ty) => visitor.visit_ts_type(&ty.type_annotation),
|
||||
TSTupleElement::TSNamedTupleMember(ty) => visitor.visit_ts_type(&ty.element_type),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2900,7 +2900,6 @@ pub mod walk_mut {
|
|||
TSTupleElement::TSType(ty) => visitor.visit_ts_type(ty),
|
||||
TSTupleElement::TSOptionalType(ty) => visitor.visit_ts_type(&mut ty.type_annotation),
|
||||
TSTupleElement::TSRestType(ty) => visitor.visit_ts_type(&mut ty.type_annotation),
|
||||
TSTupleElement::TSNamedTupleMember(ty) => visitor.visit_ts_type(&mut ty.element_type),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -509,9 +509,6 @@ impl<'a, const MINIFY: bool> Gen<MINIFY> for TSTupleElement<'a> {
|
|||
p.print_str(b"...");
|
||||
ts_type.type_annotation.gen(p, ctx);
|
||||
}
|
||||
TSTupleElement::TSNamedTupleMember(ts_type) => {
|
||||
ts_type.gen(p, ctx);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,9 +74,9 @@ impl<'a> SeparatedList<'a> for TSTupleElementList<'a> {
|
|||
p.expect(Kind::Colon)?;
|
||||
|
||||
let element_type = p.parse_ts_type()?;
|
||||
self.elements.push(TSTupleElement::TSNamedTupleMember(p.ast.alloc(
|
||||
self.elements.push(TSTupleElement::TSType(TSType::TSNamedTupleMember(p.ast.alloc(
|
||||
TSNamedTupleMember { span: p.end_span(span), element_type, label, optional },
|
||||
)));
|
||||
))));
|
||||
|
||||
return Ok(());
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue