Skip to content

Commit 6c6bb19

Browse files
committed
Use proper access methods in Dict.merge, rather than modifying the _map field manually
1 parent bda7456 commit 6c6bb19

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

src/core/primitives.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ class Dict {
236236
if (!(dict instanceof Dict)) {
237237
continue;
238238
}
239-
for (const [key, value] of dict._map) {
239+
for (const [key, value] of dict.getRawEntries()) {
240240
let property = properties.get(key);
241241
if (property === undefined) {
242242
property = [];
@@ -252,20 +252,18 @@ class Dict {
252252
}
253253
for (const [name, values] of properties) {
254254
if (values.length === 1 || !(values[0] instanceof Dict)) {
255-
mergedDict._map.set(name, values[0]);
255+
mergedDict.set(name, values[0]);
256256
continue;
257257
}
258258
const subDict = new Dict(xref);
259259

260260
for (const dict of values) {
261-
for (const [key, value] of dict._map) {
262-
if (!subDict._map.has(key)) {
263-
subDict._map.set(key, value);
264-
}
261+
for (const [key, value] of dict.getRawEntries()) {
262+
subDict.setIfNotExists(key, value);
265263
}
266264
}
267265
if (subDict.size > 0) {
268-
mergedDict._map.set(name, subDict);
266+
mergedDict.set(name, subDict);
269267
}
270268
}
271269
properties.clear();

0 commit comments

Comments
 (0)