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
42 changes: 21 additions & 21 deletions crates/oxc_angular_compiler/src/class_debug_info/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,36 +53,36 @@ fn internal_compile_class_debug_info<'a>(
let mut entries = Vec::new_in(allocator);

// className
entries.push(LiteralMapEntry {
key: Ident::from("className"),
value: literal_string_atom(allocator, debug_info.class_name.clone()),
quoted: false,
});
entries.push(LiteralMapEntry::new(
Ident::from("className"),
literal_string_atom(allocator, debug_info.class_name.clone()),
false,
));

// Include filePath and lineNumber only if filePath is set
// (matching Angular's behavior - if filePath is null, downstream consumers
// will typically ignore lineNumber as well)
if let Some(file_path) = &debug_info.file_path {
entries.push(LiteralMapEntry {
key: Ident::from("filePath"),
value: literal_string_atom(allocator, file_path.clone()),
quoted: false,
});

entries.push(LiteralMapEntry {
key: Ident::from("lineNumber"),
value: literal_number(allocator, debug_info.line_number),
quoted: false,
});
entries.push(LiteralMapEntry::new(
Ident::from("filePath"),
literal_string_atom(allocator, file_path.clone()),
false,
));

entries.push(LiteralMapEntry::new(
Ident::from("lineNumber"),
literal_number(allocator, debug_info.line_number),
false,
));
}

// Include forbidOrphanRendering only if it's true (to reduce generated code)
if debug_info.forbid_orphan_rendering {
entries.push(LiteralMapEntry {
key: Ident::from("forbidOrphanRendering"),
value: literal_bool(allocator, true),
quoted: false,
});
entries.push(LiteralMapEntry::new(
Ident::from("forbidOrphanRendering"),
literal_bool(allocator, true),
false,
));
}

let debug_info_object = OutputExpression::LiteralMap(Box::new_in(
Expand Down
38 changes: 13 additions & 25 deletions crates/oxc_angular_compiler/src/class_metadata/builders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,7 @@ pub fn build_decorator_metadata_array<'a>(
};

// Add "type" entry
map_entries.push(LiteralMapEntry {
key: Ident::from("type"),
value: type_expr,
quoted: false,
});
map_entries.push(LiteralMapEntry::new(Ident::from("type"), type_expr, false));

// Add "args" entry if the decorator has arguments
if let Expression::CallExpression(call) = &decorator.expression
Expand All @@ -84,14 +80,14 @@ pub fn build_decorator_metadata_array<'a>(
}

if !args.is_empty() {
map_entries.push(LiteralMapEntry {
key: Ident::from("args"),
value: OutputExpression::LiteralArray(Box::new_in(
map_entries.push(LiteralMapEntry::new(
Ident::from("args"),
OutputExpression::LiteralArray(Box::new_in(
LiteralArrayExpr { entries: args, source_span: None },
allocator,
)),
quoted: false,
});
false,
));
}
}

Expand Down Expand Up @@ -156,22 +152,18 @@ pub fn build_ctor_params_metadata<'a>(
))
});

map_entries.push(LiteralMapEntry {
key: Ident::from("type"),
value: type_expr,
quoted: false,
});
map_entries.push(LiteralMapEntry::new(Ident::from("type"), type_expr, false));

// Extract decorators from the parameter
let param_decorators = extract_angular_decorators_from_param(param);
if !param_decorators.is_empty() {
let decorators_array =
build_decorator_metadata_array(allocator, &param_decorators, source_text);
map_entries.push(LiteralMapEntry {
key: Ident::from("decorators"),
value: decorators_array,
quoted: false,
});
map_entries.push(LiteralMapEntry::new(
Ident::from("decorators"),
decorators_array,
false,
));
}

param_entries.push(OutputExpression::LiteralMap(Box::new_in(
Expand Down Expand Up @@ -258,11 +250,7 @@ pub fn build_prop_decorators_metadata<'a>(
let decorators_array =
build_decorator_metadata_array(allocator, &angular_decorators, source_text);

prop_entries.push(LiteralMapEntry {
key: prop_name,
value: decorators_array,
quoted: false,
});
prop_entries.push(LiteralMapEntry::new(prop_name, decorators_array, false));
}

if prop_entries.is_empty() {
Expand Down
Loading
Loading