Mercurial > octave
diff libinterp/corefcn/call-stack.cc @ 26795:80f9bc7cdf74
new functions for checking whether constructor or method is executing
* call-stack.h, call-stack.cc (call_stack::isclass_method_executing,
call_stack::isclass_constructor_executing): New functions.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 25 Feb 2019 20:20:22 +0000 |
parents | 63b5a17ba30f |
children | 6e9034836239 |
line wrap: on
line diff
--- a/libinterp/corefcn/call-stack.cc Mon Feb 25 20:10:06 2019 +0000 +++ b/libinterp/corefcn/call-stack.cc Mon Feb 25 20:20:22 2019 +0000 @@ -354,6 +354,34 @@ return retval; } + bool call_stack::is_class_method_executing (std::string& dispatch_class) const + { + dispatch_class = ""; + + octave_function *f = current (); + + bool retval = (f && f->is_class_method ()); + + if (retval) + dispatch_class = f->dispatch_class (); + + return retval; + } + + bool call_stack::is_class_constructor_executing (std::string& dispatch_class) const + { + dispatch_class = ""; + + octave_function *f = current (); + + bool retval = (f && f->is_class_constructor ()); + + if (retval) + dispatch_class = f->dispatch_class (); + + return retval; + } + bool call_stack::all_scripts (void) const { bool retval = true;