comparison 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
comparison
equal deleted inserted replaced
9580:8bf27324a9d0 9581:3d0d2bda3a0f
55 55
56 std::map<std::string, symbol_table::fcn_info> symbol_table::fcn_table; 56 std::map<std::string, symbol_table::fcn_info> symbol_table::fcn_table;
57 57
58 std::map<std::string, std::set<std::string> > symbol_table::class_precedence_table; 58 std::map<std::string, std::set<std::string> > symbol_table::class_precedence_table;
59 59
60 std::map<std::string, std::list<std::string> > symbol_table::parent_map;
61
60 const symbol_table::scope_id symbol_table::xglobal_scope = 0; 62 const symbol_table::scope_id symbol_table::xglobal_scope = 0;
61 const symbol_table::scope_id symbol_table::xtop_scope = 1; 63 const symbol_table::scope_id symbol_table::xtop_scope = 1;
62 64
63 symbol_table::scope_id symbol_table::xcurrent_scope = 1; 65 symbol_table::scope_id symbol_table::xcurrent_scope = 1;
64 66
374 retval = octave_value (fcn); 376 retval = octave_value (fcn);
375 377
376 class_methods[dispatch_type] = retval; 378 class_methods[dispatch_type] = retval;
377 } 379 }
378 } 380 }
381
382 if (retval.is_undefined ())
383 {
384 // Search parent classes
385
386 const_parent_map_iterator r = parent_map.find (dispatch_type);
387
388 if (r != parent_map.end ())
389 {
390 const std::list<std::string>& plist = r->second;
391 std::list<std::string>::const_iterator it = plist.begin ();
392
393 while (it != plist.end ())
394 {
395 retval = find_method (*it);
396
397 if (retval.is_defined ())
398 {
399 class_methods[dispatch_type] = retval;
400 break;
401 }
402
403 it++;
404 }
405 }
406 }
379 } 407 }
380 408
381 return retval; 409 return retval;
382 } 410 }
383 411