# HG changeset patch # User David Bateman # Date 1222721284 14400 # Node ID 4364389547978a48909f22c3fbde4c411675558a # Parent ccf38fc1057f8f98ffb0109f0ebdc6b99ceebf93 Check for class specific methods in symbol_table::find_function diff -r ccf38fc1057f -r 436438954797 src/ChangeLog --- a/src/ChangeLog Mon Sep 29 13:36:17 2008 -0400 +++ b/src/ChangeLog Mon Sep 29 16:48:04 2008 -0400 @@ -1,3 +1,10 @@ +2008-09-29 David Bateman + + * symtab.cc (octave_value symbol_table::find_function + (const std::string&, tree_argument_list *, const string_vector&, + octave_value_list&, bool&)): If first character of function name + is "@" then look for class specific method. + 2008-09-26 John W. Eaton * symtab.cc (out_of_date_check_internal): diff -r ccf38fc1057f -r 436438954797 src/symtab.cc --- a/src/symtab.cc Mon Sep 29 13:36:17 2008 -0400 +++ b/src/symtab.cc Mon Sep 29 16:48:04 2008 -0400 @@ -940,28 +940,45 @@ bool& args_evaluated) { octave_value retval; - size_t pos = name.find_first_of (Vfilemarker); - if (pos == std::string::npos) - retval = find (name, args, arg_names, evaluated_args, args_evaluated, true); + if (name.at(0) == '@') + { + // Looking for a class specific function + std::string dispatch_type = + 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, + std::string::npos); + + retval = find_method (method, dispatch_type); + } else { - 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 ()) + size_t pos = name.find_first_of (Vfilemarker); + + if (pos == std::string::npos) + retval = + find (name, args, arg_names, evaluated_args, args_evaluated, true); + else { - octave_function *parent_fcn = parent.function_value (); - if (parent_fcn) + 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 ()) { - xcurrent_scope = parent_fcn->scope (); - if (xcurrent_scope > 1) - retval = find_function (name.substr (pos + 1), args, arg_names, - evaluated_args, args_evaluated); + 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; } - xcurrent_scope = stored_scope; } return retval;