Mercurial > octave
diff src/symtab.cc @ 9581:3d0d2bda3a0f
fix previous change, avoid duplicate loads of methods in descendant classes
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Thu, 27 Aug 2009 16:08:23 +0200 |
parents | c5330ef7aecd |
children | a9b37bae1802 |
line wrap: on
line diff
--- a/src/symtab.cc Thu Aug 27 13:46:34 2009 +0200 +++ b/src/symtab.cc Thu Aug 27 16:08:23 2009 +0200 @@ -57,6 +57,8 @@ std::map<std::string, std::set<std::string> > symbol_table::class_precedence_table; +std::map<std::string, std::list<std::string> > symbol_table::parent_map; + const symbol_table::scope_id symbol_table::xglobal_scope = 0; const symbol_table::scope_id symbol_table::xtop_scope = 1; @@ -376,6 +378,32 @@ class_methods[dispatch_type] = retval; } } + + if (retval.is_undefined ()) + { + // Search parent classes + + const_parent_map_iterator r = parent_map.find (dispatch_type); + + if (r != parent_map.end ()) + { + const std::list<std::string>& plist = r->second; + std::list<std::string>::const_iterator it = plist.begin (); + + while (it != plist.end ()) + { + retval = find_method (*it); + + if (retval.is_defined ()) + { + class_methods[dispatch_type] = retval; + break; + } + + it++; + } + } + } } return retval;