# HG changeset patch # User John W. Eaton # Date 1222726133 14400 # Node ID 64f1cd525656e12fbb82b239f5673006119096d5 # Parent 4364389547978a48909f22c3fbde4c411675558a symtab.cc: style fixes diff -r 436438954797 -r 64f1cd525656 src/symtab.cc --- a/src/symtab.cc Mon Sep 29 16:48:04 2008 -0400 +++ b/src/symtab.cc Mon Sep 29 18:08:53 2008 -0400 @@ -941,13 +941,14 @@ { octave_value retval; - if (name.at(0) == '@') + if (! name.empty () && name[0] == '@') { - // Looking for a class specific function + // Look for a class specific function. std::string dispatch_type = - name.substr(1, name.find_first_of(file_ops::dir_sep_str ()) - 1); + name.substr (1, name.find_first_of (file_ops::dir_sep_str ()) - 1); + std::string method = - name.substr (name.find_last_of(file_ops::dir_sep_str ()) + 1, + name.substr (name.find_last_of (file_ops::dir_sep_str ()) + 1, std::string::npos); retval = find_method (method, dispatch_type); @@ -957,26 +958,30 @@ size_t pos = name.find_first_of (Vfilemarker); if (pos == std::string::npos) - retval = - find (name, args, arg_names, evaluated_args, args_evaluated, true); + retval = find (name, args, arg_names, evaluated_args, + args_evaluated, true); else { - std::string fcn_scope = name.substr(0, pos); + std::string fcn_scope = name.substr (0, pos); scope_id stored_scope = xcurrent_scope; xcurrent_scope = xtop_scope; octave_value parent = find_function (name.substr(0, pos)); + if (parent.is_defined ()) { octave_function *parent_fcn = parent.function_value (); + if (parent_fcn) { xcurrent_scope = parent_fcn->scope (); + if (xcurrent_scope > 1) retval = find_function (name.substr (pos + 1), args, arg_names, evaluated_args, args_evaluated); } } + xcurrent_scope = stored_scope; } } @@ -1012,7 +1017,6 @@ os << "\n"; } - inst->do_dump (os); } }