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
4 changes: 1 addition & 3 deletions crates/oxc_angular_compiler/src/i18n/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -575,9 +575,7 @@ impl Visitor for CloneVisitor {
Node::IcuPlaceholder(IcuPlaceholder::new(icu, ph.name.clone(), ph.source_span.clone()))
} else {
// visit_icu should always return Node::Icu by design.
// This is a compiler bug if we reach here.
debug_assert!(false, "visit_icu should return Node::Icu");
// Return the original placeholder unchanged as fallback
// Return the original placeholder unchanged as a safe fallback.
Node::IcuPlaceholder(ph.clone())
}
}
Expand Down
7 changes: 1 addition & 6 deletions crates/oxc_angular_compiler/src/output/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1389,12 +1389,7 @@ impl<'a> OutputExpression<'a> {
OutputExpression::WrappedIrNode(_) => {
// WrappedIrNode expressions wrap IR expressions for deferred processing.
// They should be resolved during the reify phase before any cloning occurs.
// If we hit this, it's a compiler bug.
debug_assert!(
false,
"Cannot clone a WrappedIrExpr. WrappedIrExpr should be resolved before cloning."
);
// Return a placeholder undefined literal
// Return a placeholder undefined literal as a safe fallback.
OutputExpression::Literal(Box::new_in(
LiteralExpr { value: LiteralValue::Undefined, source_span: None },
allocator,
Expand Down
6 changes: 4 additions & 2 deletions crates/oxc_angular_compiler/src/output/emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ impl EmitterContext {
/// Lines is always non-empty: initialized with one element in `new()`,
/// and `println()` only pushes (never pops below 1).
fn current_line(&self) -> &EmittedLine {
debug_assert!(!self.lines.is_empty(), "lines should never be empty");
// Invariant: lines is always non-empty (initialized with one element in new(),
// and println() only pushes, never pops below 1).
&self.lines[self.lines.len() - 1]
}

Expand All @@ -123,7 +124,8 @@ impl EmitterContext {
/// Lines is always non-empty: initialized with one element in `new()`,
/// and `println()` only pushes (never pops below 1).
fn current_line_mut(&mut self) -> &mut EmittedLine {
debug_assert!(!self.lines.is_empty(), "lines should never be empty");
// Invariant: lines is always non-empty (initialized with one element in new(),
// and println() only pushes, never pops below 1).
let len = self.lines.len();
&mut self.lines[len - 1]
}
Expand Down
Loading
Loading