Mercurial > octave
diff libinterp/octave-value/ov-fcn-handle.h @ 26966:4ba365817652
allow dispatch class to be stored in octave_fcn_handle (bug #45351)
* ov-fcn-handle.h, ov-fcn-handle.cc
(octave_fcn_handle::m_dispatch_class): New data member.
(octave_fcn_handle::set_dispatch_class,
octave_fcn_handle::get_dispatch_class): New methods.
(make_fcn_handle): If handle is created inside a classdef method or
constructor, store dispatch class in function handle object.
(octave_fcn_handle::call): Temporarily set dispatch type for function
call in call stack.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 25 Mar 2019 16:21:11 +0000 |
parents | b033cf021048 |
children | b442ec6dda5c |
line wrap: on
line diff
--- a/libinterp/octave-value/ov-fcn-handle.h Mon Mar 25 16:13:01 2019 +0000 +++ b/libinterp/octave-value/ov-fcn-handle.h Mon Mar 25 16:21:11 2019 +0000 @@ -58,7 +58,7 @@ octave_fcn_handle (void) : m_fcn (), m_obj (), m_name (), m_scope (), m_is_nested (false), - m_closure_frames (nullptr) + m_closure_frames (nullptr), m_dispatch_class () { } octave_fcn_handle (const octave::symbol_scope& scope, const std::string& n); @@ -118,6 +118,13 @@ octave_value workspace (void) const; + void set_dispatch_class (const std::string& class_name) + { + m_dispatch_class = class_name; + } + + std::string get_dispatch_class (void) const { return m_dispatch_class; } + bool is_equal_to (const octave_fcn_handle&) const; octave_value convert_to_str_internal (bool pad, bool force, char type) const; @@ -179,6 +186,11 @@ // functions indirectly through handles. std::list<octave::stack_frame *> *m_closure_frames; + // The name of the class in which this handle was created, if any. + // Used to determine access permission when the referenced function is + // called. + std::string m_dispatch_class; + bool parse_anon_fcn_handle (const std::string& fcn_text); virtual octave_value_list call (int nargout, const octave_value_list& args);