Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions crates/oxc_angular_compiler/src/component/hoist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ use oxc_ast::ast::{
};
use oxc_ast_visit::Visit;
use oxc_semantic::Semantic;
use oxc_span::GetSpan;
use oxc_span::{GetSpan, Span};
use oxc_syntax::symbol::SymbolId;

use crate::directive::StringConsts;
Expand Down Expand Up @@ -94,6 +94,8 @@ struct PlanEntry {
/// insertion at the same offset pushes earlier text further right — the
/// hoisted statements end up immediately above the class, with any
/// constant-pool declarations from the compiler in between.
///
/// A hoisted statement keeps the signal `debugName`s inside it.
pub fn collect_hoist_edits<'a>(
program: &Program<'a>,
source: &str,
Expand Down Expand Up @@ -649,9 +651,10 @@ pub fn collect_hoist_edits<'a>(

for stmt_start in &order {
let p = &plan[stmt_start];
let text = &source[*stmt_start as usize..p.stmt_end as usize];
let text =
super::signal_debug_name::source_text(source, Span::new(*stmt_start, p.stmt_end));
let bucket = per_target.entry(p.insert_at).or_default();
bucket.push_str(text);
bucket.push_str(&text);
bucket.push('\n');
edits.push(Edit::delete(*stmt_start, p.delete_end).with_priority(HOIST_DELETE_PRIORITY));
}
Expand Down
1 change: 1 addition & 0 deletions crates/oxc_angular_compiler/src/component/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ mod hoist;
mod import_elision;
mod metadata;
mod namespace_registry;
pub(crate) mod signal_debug_name;
mod transform;

#[cfg(feature = "cross_file_elision")]
Expand Down
Loading
Loading