mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
refactor(mangler): simplify initialization of slots (#8734)
I just found that `Vec::resize_with` uses `iter::repeat_*` to initialize the value.
This commit is contained in:
parent
9e32f55a8c
commit
52a37d0f06
1 changed files with 3 additions and 5 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
use std::ops::Deref;
|
use std::{iter, ops::Deref};
|
||||||
|
|
||||||
use fixedbitset::FixedBitSet;
|
use fixedbitset::FixedBitSet;
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
|
|
@ -179,10 +179,8 @@ impl Mangler {
|
||||||
let allocator = Allocator::default();
|
let allocator = Allocator::default();
|
||||||
|
|
||||||
// All symbols with their assigned slots. Keyed by symbol id.
|
// All symbols with their assigned slots. Keyed by symbol id.
|
||||||
let mut slots: Vec<'_, Slot> = Vec::with_capacity_in(symbol_table.len(), &allocator);
|
let mut slots: Vec<'_, Slot> =
|
||||||
for _ in 0..symbol_table.len() {
|
Vec::from_iter_in(iter::repeat_n(0, symbol_table.len()), &allocator);
|
||||||
slots.push(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Stores the lived scope ids for each slot. Keyed by slot number.
|
// Stores the lived scope ids for each slot. Keyed by slot number.
|
||||||
let mut slot_liveness: std::vec::Vec<FixedBitSet> = vec![];
|
let mut slot_liveness: std::vec::Vec<FixedBitSet> = vec![];
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue