mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 12:19:15 +00:00
refactor(transformer): StatementInjectorStore::insert_many_after take an iterator (#6856)
Follow-on after #6654. Taking an `IntoIterator` avoids caller needing to construct a temporary `Vec`.
This commit is contained in:
parent
a47c70e425
commit
7339dde473
2 changed files with 5 additions and 3 deletions
|
|
@ -86,7 +86,10 @@ impl<'a> StatementInjectorStore<'a> {
|
|||
}
|
||||
|
||||
/// Add multiple statements to be inserted immediately after the target statement.
|
||||
pub fn insert_many_after(&self, target: Address, stmts: Vec<Statement<'a>>) {
|
||||
pub fn insert_many_after<S>(&self, target: Address, stmts: S)
|
||||
where
|
||||
S: IntoIterator<Item = Statement<'a>>,
|
||||
{
|
||||
let mut insertions = self.insertions.borrow_mut();
|
||||
let adjacent_stmts = insertions.entry(target).or_default();
|
||||
adjacent_stmts.extend(
|
||||
|
|
|
|||
|
|
@ -417,8 +417,7 @@ impl<'a, 'ctx> Traverse<'a> for TypeScriptAnnotations<'a, 'ctx> {
|
|||
stmt.address(),
|
||||
self.assignments
|
||||
.iter()
|
||||
.map(|assignment| assignment.create_this_property_assignment(ctx))
|
||||
.collect::<Vec<_>>(),
|
||||
.map(|assignment| assignment.create_this_property_assignment(ctx)),
|
||||
);
|
||||
self.has_super_call = true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue