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:
Donny/강동윤 2023-12-08 10:57:27 +09:00 committed by GitHub
parent f0c852af95
commit 6a73d47aa1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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()));