Ensure that the empty dictionary won't be accidentally modified
Currently there's nothing that prevents modification of the `Dict.empty` primitive, which obviously needs to be *truly* empty to prevent any future (hard to find) bugs.
This commit is contained in:
parent
b0c7a74a0c
commit
a531c98cd2
@ -171,7 +171,14 @@ var Dict = (function DictClosure() {
|
||||
},
|
||||
};
|
||||
|
||||
Dict.empty = new Dict(null);
|
||||
Dict.empty = (function () {
|
||||
const emptyDict = new Dict(null);
|
||||
|
||||
emptyDict.set = (key, value) => {
|
||||
unreachable("Should not call `set` on the empty dictionary.");
|
||||
};
|
||||
return emptyDict;
|
||||
})();
|
||||
|
||||
Dict.merge = function ({ xref, dictArray, mergeSubDicts = false }) {
|
||||
const mergedDict = new Dict(xref);
|
||||
|
Loading…
Reference in New Issue
Block a user