comparison src/DLD-FUNCTIONS/cellfun.cc @ 12952:5a5cb2a4b71d

cellfun: Fix a regression for function handles to overloaded functions
author Jordi Gutiérrez Hermoso <jordigh@gmail.com>
date Thu, 11 Aug 2011 17:17:25 -0500
parents d1db86336a49
children 983720941822
comparison
equal deleted inserted replaced
12949:d1db86336a49 12952:5a5cb2a4b71d
55 #include "ov-int64.h" 55 #include "ov-int64.h"
56 #include "ov-uint8.h" 56 #include "ov-uint8.h"
57 #include "ov-uint16.h" 57 #include "ov-uint16.h"
58 #include "ov-uint32.h" 58 #include "ov-uint32.h"
59 #include "ov-uint64.h" 59 #include "ov-uint64.h"
60
61 #include "ov-fcn-handle.h"
60 62
61 static octave_value_list 63 static octave_value_list
62 get_output_list (octave_idx_type count, octave_idx_type nargout, 64 get_output_list (octave_idx_type count, octave_idx_type nargout,
63 const octave_value_list& inputlist, 65 const octave_value_list& inputlist,
64 octave_value& func, 66 octave_value& func,
357 // give a more specific function class, so this can result in 359 // give a more specific function class, so this can result in
358 // fewer polymorphic function calls as the function gets called 360 // fewer polymorphic function calls as the function gets called
359 // for each value of the array. 361 // for each value of the array.
360 if (! symbol_table_lookup ) 362 if (! symbol_table_lookup )
361 { 363 {
362 octave_value f = symbol_table::find_function ( func.function_value () 364 if (func.is_function_handle ())
365 {
366 octave_fcn_handle* f = func.fcn_handle_value ();
367
368 // Overloaded function handles need to check the type of
369 // the arguments for each element of the array, so they
370 // cannot be optimised this way.
371 if (f -> is_overloaded ())
372 goto nevermind;
373 }
374 octave_value f = symbol_table::find_function (func.function_value ()
363 -> name ()); 375 -> name ());
364 if (f.is_defined ()) 376 if (f.is_defined ())
365 func = f; 377 func = f;
366 } 378 }
379 nevermind:
367 380
368 unwind_protect frame; 381 unwind_protect frame;
369 frame.protect_var (buffer_error_messages); 382 frame.protect_var (buffer_error_messages);
370 383
371 bool uniform_output = true; 384 bool uniform_output = true;