From 6c6bb1932477c260dade4bdb5ac6b5205216f368 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Tue, 17 Mar 2026 12:00:35 +0100 Subject: [PATCH] Use proper access methods in `Dict.merge`, rather than modifying the `_map` field manually --- src/core/primitives.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/core/primitives.js b/src/core/primitives.js index 70220ffa3..5ff623458 100644 --- a/src/core/primitives.js +++ b/src/core/primitives.js @@ -236,7 +236,7 @@ class Dict { if (!(dict instanceof Dict)) { continue; } - for (const [key, value] of dict._map) { + for (const [key, value] of dict.getRawEntries()) { let property = properties.get(key); if (property === undefined) { property = []; @@ -252,20 +252,18 @@ class Dict { } for (const [name, values] of properties) { if (values.length === 1 || !(values[0] instanceof Dict)) { - mergedDict._map.set(name, values[0]); + mergedDict.set(name, values[0]); continue; } const subDict = new Dict(xref); for (const dict of values) { - for (const [key, value] of dict._map) { - if (!subDict._map.has(key)) { - subDict._map.set(key, value); - } + for (const [key, value] of dict.getRawEntries()) { + subDict.setIfNotExists(key, value); } } if (subDict.size > 0) { - mergedDict._map.set(name, subDict); + mergedDict.set(name, subDict); } } properties.clear();