Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sourcemap generation to JavaScript codegen target #3675

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
004f9a8
Basic support for generating SourceMaps on Typescript target
AlisCode Sep 29, 2024
ef807f0
Produce Sourcemap for case
AlisCode Sep 29, 2024
af87895
Add sourcemap for todo and panic instructions
AlisCode Sep 29, 2024
dd6f895
Add sourcemap support for type declaration
AlisCode Sep 29, 2024
bb2c476
Support sourcemap for assert
AlisCode Sep 29, 2024
067a3ec
Attach sourcemap location to more expressions
AlisCode Sep 30, 2024
f8e7bc2
Attach sourcemap location for inputs
AlisCode Sep 30, 2024
2f78884
Cleanup sourcemap generation by not generating sourcemaps for ALL ass…
AlisCode Oct 2, 2024
2797e29
Attach sourcemap location for pipeline and more expressions
AlisCode Oct 4, 2024
ca38425
Attach more sourcemap location
AlisCode Oct 4, 2024
14e31ca
Attach sourcemap location to tail-call-optimized functions
AlisCode Oct 4, 2024
667d11a
Attach sourcemap location to external functions
AlisCode Oct 4, 2024
fb8d9b1
Simplify sourcemap attachment process and harmonize usage across the …
AlisCode Oct 4, 2024
67f9175
Setup test infra for sourcemaps
AlisCode Oct 5, 2024
ceb4407
Cleanup implementation details to prepare for a PR
AlisCode Oct 6, 2024
8575228
Rename sourcemap-generation functionality sourcemap->sourcemaps
AlisCode Oct 7, 2024
55b8d10
Correct minor comments
AlisCode Oct 7, 2024
60b9974
Reduce the size of the SourceMapEmitter by boxing the SourceMapBuilder
AlisCode Oct 6, 2024
415afd9
Remove SourceMap information from formatting API
AlisCode Oct 9, 2024
73fa02d
Move sourcemap content generation to the sourcemap module, document t…
AlisCode Oct 15, 2024
d4d079b
Reuse LineNumbers inside CursorPositionWriter
AlisCode Oct 24, 2024
56d12a1
Move sourcemap declaration at the top
AlisCode Oct 24, 2024
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
Prev Previous commit
Next Next commit
Support sourcemap for assert
  • Loading branch information
AlisCode committed Dec 29, 2024

Verified

This commit was signed with the committer’s verified signature.
joshmanders Josh Manders
commit bb2c4760df53871e2d7016e777f770848f75931c
6 changes: 5 additions & 1 deletion compiler-core/src/javascript/expression.rs
Original file line number Diff line number Diff line change
@@ -1149,6 +1149,9 @@ impl<'module> Generator<'module> {
message: Option<&'a TypedExpr>,
) -> Output<'a> {
let checks = self.pattern_checks_doc(checks, false);
let (start, end) = self
.line_numbers
.line_and_column_number_of_src_span(location);
Ok(docvec![
"if (",
docvec![break_("", ""), checks].nest(INDENT),
@@ -1162,7 +1165,8 @@ impl<'module> Generator<'module> {
line(),
"}",
]
.group())
.group()
.attach_sourcemap_location(start, end))
}

fn pattern_assignments_doc(assignments: Vec<Assignment<'_>>) -> Document<'_> {