Don't override existing entries when inheriting various hashes.

Check if the value being inherited doesn't already exist for the derived
class: if it does, we must not overwrite it.

Fixes regression introduced in r12865.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12874 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Vadim Zeitlin 2011-12-11 16:29:51 +00:00
commit 9cdc66cc84

View file

@ -590,11 +590,12 @@ void Swig_name_object_inherit(Hash *namehash, String *base, String *derived) {
Hash *n = ki.item;
Hash *newh;
if (!derh)
derh = NewHash();
newh = Getattr(derh, nkey);
/* Don't overwrite an existing value for the derived class, if any. */
newh = Getattr(namehash, nkey);
if (!newh) {
if (!derh)
derh = NewHash();
newh = NewHash();
Setattr(derh, nkey, newh);
Delete(newh);