You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
swc_common::SourceMap was copied from rustc while implementing the parser. I didn't know anything about the compiler, parser or performance things at the moment.
It's designed for rustc, not SWC. It's about centralizing source file spans and error reporting. But it causes some problems for SWC.
Decision Drivers
It's designed for a short-lived process, rustc. rustc does not need to deallocate the source string because the process is terminated after compiling a single crate.
BytePos is an interned pointer to somewhere in swc_common::SourceMap, and SourceMap contains information about the input source code. But it's also problematic. Carrying Arc<swc_common::SourceMap> everywhere is not a good idea, and SourceFile has too many information about the source code. For most of files, we don't use those information at all.
…
Considered Options
[option 1]
[option 2]
[option 3]
…
Decision Outcome
Chosen option: "[option 1]", because [justification. e.g., only option, which meets k.o. criterion decision driver | which resolves force force | … | comes out best (see below)].
Positive Consequences
[e.g., improvement of quality attribute satisfaction, follow-up decisions required, …]
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'll add more soon
Technical Story: [description | ticket/issue URL]
Context and Problem Statement
swc_common::SourceMap
was copied fromrustc
while implementing the parser. I didn't know anything about the compiler, parser or performance things at the moment.It's designed for
rustc
, not SWC. It's about centralizing source file spans and error reporting. But it causes some problems for SWC.Decision Drivers
It's designed for a short-lived process,
rustc
.rustc
does not need to deallocate the source string because the process is terminated after compiling a single crate.BytePos
is an interned pointer to somewhere inswc_common::SourceMap
, andSourceMap
contains information about the input source code. But it's also problematic. CarryingArc<swc_common::SourceMap>
everywhere is not a good idea, andSourceFile
has too many information about the source code. For most of files, we don't use those information at all.…
Considered Options
Decision Outcome
Chosen option: "[option 1]", because [justification. e.g., only option, which meets k.o. criterion decision driver | which resolves force force | … | comes out best (see below)].
Positive Consequences
Negative Consequences
Pros and Cons of the Options
[option 1]
[example | description | pointer to more information | …]
[option 2]
[example | description | pointer to more information | …]
[option 3]
[example | description | pointer to more information | …]
Links
Beta Was this translation helpful? Give feedback.
All reactions