Mercurial > octave
comparison src/symtab.cc @ 8160:436438954797
Check for class specific methods in symbol_table::find_function
author | David Bateman <dbateman@free.fr> |
---|---|
date | Mon, 29 Sep 2008 16:48:04 -0400 |
parents | 344c9b6532a2 |
children | 64f1cd525656 |
comparison
equal
deleted
inserted
replaced
8159:ccf38fc1057f | 8160:436438954797 |
---|---|
938 const string_vector& arg_names, | 938 const string_vector& arg_names, |
939 octave_value_list& evaluated_args, | 939 octave_value_list& evaluated_args, |
940 bool& args_evaluated) | 940 bool& args_evaluated) |
941 { | 941 { |
942 octave_value retval; | 942 octave_value retval; |
943 size_t pos = name.find_first_of (Vfilemarker); | 943 |
944 | 944 if (name.at(0) == '@') |
945 if (pos == std::string::npos) | 945 { |
946 retval = find (name, args, arg_names, evaluated_args, args_evaluated, true); | 946 // Looking for a class specific function |
947 std::string dispatch_type = | |
948 name.substr(1, name.find_first_of(file_ops::dir_sep_str ()) - 1); | |
949 std::string method = | |
950 name.substr (name.find_last_of(file_ops::dir_sep_str ()) + 1, | |
951 std::string::npos); | |
952 | |
953 retval = find_method (method, dispatch_type); | |
954 } | |
947 else | 955 else |
948 { | 956 { |
949 std::string fcn_scope = name.substr(0, pos); | 957 size_t pos = name.find_first_of (Vfilemarker); |
950 scope_id stored_scope = xcurrent_scope; | 958 |
951 xcurrent_scope = xtop_scope; | 959 if (pos == std::string::npos) |
952 octave_value parent = find_function (name.substr(0, pos)); | 960 retval = |
953 if (parent.is_defined ()) | 961 find (name, args, arg_names, evaluated_args, args_evaluated, true); |
954 { | 962 else |
955 octave_function *parent_fcn = parent.function_value (); | 963 { |
956 if (parent_fcn) | 964 std::string fcn_scope = name.substr(0, pos); |
965 scope_id stored_scope = xcurrent_scope; | |
966 xcurrent_scope = xtop_scope; | |
967 octave_value parent = find_function (name.substr(0, pos)); | |
968 if (parent.is_defined ()) | |
957 { | 969 { |
958 xcurrent_scope = parent_fcn->scope (); | 970 octave_function *parent_fcn = parent.function_value (); |
959 if (xcurrent_scope > 1) | 971 if (parent_fcn) |
960 retval = find_function (name.substr (pos + 1), args, arg_names, | 972 { |
961 evaluated_args, args_evaluated); | 973 xcurrent_scope = parent_fcn->scope (); |
974 if (xcurrent_scope > 1) | |
975 retval = find_function (name.substr (pos + 1), args, | |
976 arg_names, evaluated_args, | |
977 args_evaluated); | |
978 } | |
962 } | 979 } |
963 } | 980 xcurrent_scope = stored_scope; |
964 xcurrent_scope = stored_scope; | 981 } |
965 } | 982 } |
966 | 983 |
967 return retval; | 984 return retval; |
968 } | 985 } |
969 | 986 |