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
2 changes: 2 additions & 0 deletions crates/oxc_codegen/src/gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1473,6 +1473,7 @@ impl Gen for ArrayExpression<'_> {
p.print_indent();
}
p.print_ascii_byte(b']');
p.add_source_mapping_end(self.span);
}
}

Expand Down Expand Up @@ -1515,6 +1516,7 @@ impl GenExpr for ObjectExpression<'_> {
p.print_soft_space();
}
p.print_ascii_byte(b'}');
p.add_source_mapping_end(self.span);
});
}
}
Expand Down
8 changes: 8 additions & 0 deletions crates/oxc_codegen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,14 @@ impl<'a> Codegen<'a> {
}
}

fn add_source_mapping_end(&mut self, span: Span) {
if let Some(sourcemap_builder) = self.sourcemap_builder.as_mut() {
if !span.is_empty() {
sourcemap_builder.add_source_mapping(self.code.as_bytes(), span.end, None);
}
}
}

fn add_source_mapping_for_name(&mut self, span: Span, name: &str) {
if let Some(sourcemap_builder) = self.sourcemap_builder.as_mut() {
if !span.is_empty() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ obj.fn([1])();

Error
at <anonymous> (/project/input.js:5:19)
at <anonymous> (/project/input.js:9:9)
at <anonymous> (/project/input.js:9:11)

------------------------------------------------------
## Input
Expand Down Expand Up @@ -180,7 +180,7 @@ obj.fn({ a })();

Error
at <anonymous> (/project/input.js:6:19)
at <anonymous> (/project/input.js:10:9)
at <anonymous> (/project/input.js:10:11)

------------------------------------------------------
## Input
Expand Down
Loading