mirror of
https://github.com/swc-project/swc.git
synced 2024-12-25 22:56:11 +03:00
perf(common): Fix OOM of inputSourceMap
(#8402)
**Description:** The previous code was very strange, and it could easily cause OOM.
This commit is contained in:
parent
f0c852af95
commit
6a73d47aa1
@ -1331,8 +1331,9 @@ impl SourceMap {
|
||||
if token.has_name() {
|
||||
name = token.get_name();
|
||||
}
|
||||
if let Some(src) = token.get_source() {
|
||||
src_id = builder.add_source(src);
|
||||
if token.get_source().is_some() {
|
||||
// When we have the original source map, we use the source ids from it
|
||||
src_id = token.get_raw_token().src_id;
|
||||
if inline_sources_content && !builder.has_source_contents(src_id) {
|
||||
if let Some(contents) = token.get_source_view() {
|
||||
builder.set_source_contents(src_id, Some(contents.source()));
|
||||
|
Loading…
Reference in New Issue
Block a user