private void PropagateKeys(NamespaceDictionary nd) { for (int i = 0; i < keys.Length && i < nd.keys.Length; i++) { if (nd.keys[i] == keys[i]) { // common case: our layout matches our parents PropagateInheritedKey(i, i, nd); } else { // uncommon case - multiple inheritance only (maybe?) for (int j = 0; j < keys.Length; j++) { if (nd.keys[i] == keys[j]) { PropagateInheritedKey(i, j, nd); } } } } }
private void PropagateInheritedKey(int from, int to, NamespaceDictionary parent) { if (!parent.isInherited[from] && isInherited[to]) { // our parent didn't has an override, so we get // their override too. Both are user defined functions // so we clear isInherited for this slot. values[to] = parent.values[from]; isInherited[to] = false; } }