comparison src/symtab.cc @ 11238:1783b360976f

also consider parent classes when checking if class methods are out of date
author John W. Eaton <jwe@octave.org>
date Thu, 11 Nov 2010 02:30:32 -0500
parents 89f4d7e294cc
children c78247b664fc
comparison
equal deleted inserted replaced
11237:110e570e5f8d 11238:1783b360976f
206 // We don't want to make this an absolute name, 206 // We don't want to make this an absolute name,
207 // because load_fcn_file looks at the name to 207 // because load_fcn_file looks at the name to
208 // decide whether it came from a relative lookup. 208 // decide whether it came from a relative lookup.
209 209
210 if (! dispatch_type.empty ()) 210 if (! dispatch_type.empty ())
211 file = load_path::find_method (dispatch_type, nm, 211 {
212 dir_name); 212 file = load_path::find_method (dispatch_type, nm,
213 dir_name);
214
215 if (file.empty ())
216 {
217 const std::list<std::string>& plist
218 = symbol_table::parent_classes (dispatch_type);
219 std::list<std::string>::const_iterator it
220 = plist.begin ();
221
222 while (it != plist.end ())
223 {
224 file = load_path::find_method (*it, nm, dir_name);
225 if (! file.empty ())
226 break;
227
228 it++;
229 }
230 }
231 }
213 232
214 // Maybe it's an autoload? 233 // Maybe it's an autoload?
215 if (file.empty ()) 234 if (file.empty ())
216 file = lookup_autoload (nm); 235 file = lookup_autoload (nm);
217 236
385 404
386 if (retval.is_undefined ()) 405 if (retval.is_undefined ())
387 { 406 {
388 // Search parent classes 407 // Search parent classes
389 408
390 const_parent_map_iterator r = parent_map.find (dispatch_type); 409 const std::list<std::string>& plist = parent_classes (dispatch_type);
391 410
392 if (r != parent_map.end ()) 411 std::list<std::string>::const_iterator it = plist.begin ();
412
413 while (it != plist.end ())
393 { 414 {
394 const std::list<std::string>& plist = r->second; 415 retval = find_method (*it);
395 std::list<std::string>::const_iterator it = plist.begin (); 416
396 417 if (retval.is_defined ())
397 while (it != plist.end ())
398 { 418 {
399 retval = find_method (*it); 419 class_methods[dispatch_type] = retval;
400 420 break;
401 if (retval.is_defined ())
402 {
403 class_methods[dispatch_type] = retval;
404 break;
405 }
406
407 it++;
408 } 421 }
422
423 it++;
409 } 424 }
410 } 425 }
411 } 426 }
412 427
413 return retval; 428 return retval;