Unverified Commit d80102cb authored by Benjamin Woodruff's avatar Benjamin Woodruff Committed by GitHub

chore(turbopack-core): Delete dead `all_modules_and_affecting_sources` helper function (#73016)

Dead code strikes again.

https://github.com/est31/warnalyzer has been updated for recent rust toolchains, so I might give that a shot soon to see if I can clean up all of our dead functions.
parent a3960c21
use std::collections::{HashSet, VecDeque}; use std::collections::HashSet;
use anyhow::Result; use anyhow::Result;
use turbo_rcstr::RcStr; use turbo_rcstr::RcStr;
...@@ -9,7 +9,6 @@ use turbo_tasks::{ ...@@ -9,7 +9,6 @@ use turbo_tasks::{
use crate::{ use crate::{
chunk::{ChunkableModuleReference, ChunkingType, ChunkingTypeOption}, chunk::{ChunkableModuleReference, ChunkingType, ChunkingTypeOption},
issue::IssueDescriptionExt,
module::{Module, Modules}, module::{Module, Modules},
output::{OutputAsset, OutputAssets}, output::{OutputAsset, OutputAssets},
raw_module::RawModule, raw_module::RawModule,
...@@ -268,31 +267,6 @@ pub async fn primary_referenced_modules(module: Vc<Box<dyn Module>>) -> Result<V ...@@ -268,31 +267,6 @@ pub async fn primary_referenced_modules(module: Vc<Box<dyn Module>>) -> Result<V
Ok(Vc::cell(modules)) Ok(Vc::cell(modules))
} }
/// Aggregates all [Module]s referenced by an [Module] including transitively
/// referenced [Module]s. This basically gives all [Module]s in a subgraph
/// starting from the passed [Module].
#[turbo_tasks::function]
pub async fn all_modules_and_affecting_sources(
asset: ResolvedVc<Box<dyn Module>>,
) -> Result<Vc<Modules>> {
// TODO need to track import path here
let mut queue = VecDeque::with_capacity(32);
queue.push_back((asset, referenced_modules_and_affecting_sources(*asset)));
let mut assets = HashSet::new();
assets.insert(asset);
while let Some((parent, references)) = queue.pop_front() {
let references = references
.issue_file_path(parent.ident().path(), "expanding references of asset")
.await?;
for asset in references.await?.iter() {
if assets.insert(*asset) {
queue.push_back((*asset, referenced_modules_and_affecting_sources(**asset)));
}
}
}
Ok(Vc::cell(assets.into_iter().collect()))
}
/// Walks the asset graph from multiple assets and collect all referenced /// Walks the asset graph from multiple assets and collect all referenced
/// assets. /// assets.
#[turbo_tasks::function] #[turbo_tasks::function]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment