bool Token::InheritsFrom(Token* token) { if (!token) return false; for (unsigned int i = 0; i < m_Ancestors.GetCount(); ++i) { Token* ancestor = m_Ancestors[i]; if (ancestor == token || ancestor->InheritsFrom(token)) return true; } return false; }
bool Token::InheritsFrom(int idx) const { if (idx < 0 || !m_pTree) return false; Token* token = m_pTree->at(idx); if(!token) return false; for (TokenIdxSet::iterator it = m_DirectAncestors.begin(); it != m_DirectAncestors.end(); it++) { int idx2 = *it; Token* ancestor = m_pTree->at(idx2); if(!ancestor) continue; if (ancestor == token || ancestor->InheritsFrom(idx)) // ##### is this intended? return true; } return false; }