-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(common): Debug-print spans more compactly (#8746)
**Description:** `dbg!()` output on ASTs is kinda verbose, ```rs ExprStmt { span: Span { lo: BytePos( 37, ), hi: BytePos( 50, ), ctxt: #0, }, expr: Lit( Str( Str { span: Span { lo: BytePos( 37, ), hi: BytePos( 49, ), ctxt: #0, }, value: "use strict", raw: Some( "\"use strict\"", ), }, ), ), } ``` A lot of the space is wasted on spans — 9 lines per span, even though it's pretty much unimportant cruft. This PR changes that to just one line per span: ```rs ExprStmt { span: 37..50#0, expr: Lit( Str( Str { span: 37..49#0, value: "use strict", raw: Some( "\"use strict\"", ), }, ), ), } ``` While not a statistically meaningful measurement, in my tests (sample size = 1) this change reduces the `dbg!()` of a 1103-byte script from 5597 to 2885 lines, which is a 48% reduction. In `{:?}` mode it goes from 40034 to 25457 chars, or 37% reduction.
- Loading branch information
Showing
223 changed files
with
3,904 additions
and
35,500 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.