Skip to content

Commit

Permalink
Fix parsed of split()
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Sep 3, 2024
1 parent 086b8e7 commit 96a1dfd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 2 additions & 3 deletions turbopack/crates/turbopack-ecmascript/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -510,9 +510,8 @@ impl EcmascriptModuleAsset {
}

#[turbo_tasks::function]
pub async fn split(self: Vc<Self>) -> Result<Vc<SplitResult>> {
pub async fn split(self: Vc<Self>, parsed: Vc<ParseResult>) -> Result<Vc<SplitResult>> {
let this = self.await?;
let parsed = self.parse_raw();

Ok(split(
this.source.ident(),
Expand Down Expand Up @@ -545,7 +544,7 @@ impl EcmascriptModuleAsset {
let this = self.await?;

let parsed = if let Some(part) = part {
let split_data = self.split();
let split_data = self.split(parsed);
part_of_module(split_data, part)
} else {
parsed
Expand Down
6 changes: 4 additions & 2 deletions turbopack/crates/turbopack-ecmascript/src/tree_shake/asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ impl Module for EcmascriptModulePartAsset {
#[turbo_tasks::function]
async fn ident(&self) -> Result<Vc<AssetIdent>> {
let inner = self.full_module.ident();
let result = self.full_module.split();
let parsed = self.full_module.parse_raw();
let result = self.full_module.split(parsed);

match &*result.await? {
SplitResult::Ok { .. } => Ok(inner.with_part(self.part)),
Expand All @@ -135,7 +136,8 @@ impl Module for EcmascriptModulePartAsset {

#[turbo_tasks::function]
async fn references(&self) -> Result<Vc<ModuleReferences>> {
let split_data = self.full_module.split().await?;
let parsed = self.full_module.parse_raw();
let split_data = self.full_module.split(parsed).await?;

let analyze = analyze(self.full_module, self.part, None).await?;

Expand Down

0 comments on commit 96a1dfd

Please sign in to comment.