Mercurial > hg > octave-nkf
changeset 18358:ff311e5ff6d8
Don't call classdef-overloaded subsref from builtin calls.
* ov-class.cc (called_from_builtin): Moved to ov-base.cc.
* ov-base.cc (called_from_builtin): Moved from ov-class.cc.
* ov-base.h (called_from_builtin): Declare in octave API.
* ov-classdef.cc (octave_classdef::subsref): Don't call overloaded
subsref when called from "builtin".
author | Michael Goffioul <michael.goffioul@gmail.com> |
---|---|
date | Mon, 20 Jan 2014 22:16:22 -0500 |
parents | 06eb893b9db6 |
children | 0187ed948627 |
files | libinterp/octave-value/ov-base.cc libinterp/octave-value/ov-base.h libinterp/octave-value/ov-class.cc libinterp/octave-value/ov-classdef.cc |
diffstat | 4 files changed, 20 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/octave-value/ov-base.cc +++ b/libinterp/octave-value/ov-base.cc @@ -52,6 +52,7 @@ #include "parse.h" #include "pr-output.h" #include "utils.h" +#include "toplev.h" #include "variables.h" builtin_type_t btyp_mixed_numeric (builtin_type_t x, builtin_type_t y) @@ -1627,6 +1628,20 @@ return retval; } +bool +called_from_builtin (void) +{ + octave_function *fcn = octave_call_stack::caller (); + + // FIXME: we probably need a better check here, or some other + // mechanism to avoid overloaded functions when builtin is used. + // For example, what if someone overloads the builtin function? + // Also, are there other places where using builtin is not properly + // avoiding dispatch? + + return (fcn && fcn->name () == "builtin"); +} + void install_base_type_conversions (void) {
--- a/libinterp/octave-value/ov-base.h +++ b/libinterp/octave-value/ov-base.h @@ -836,4 +836,8 @@ const std::list<octave_value_list>& idx, const std::string& who); +// Tells whether some regular octave_value_base methods are being called from +// within the "builtin" function. +extern OCTINTERP_API bool called_from_builtin (void); + #endif
--- a/libinterp/octave-value/ov-class.cc +++ b/libinterp/octave-value/ov-class.cc @@ -307,20 +307,6 @@ return retval; } -static bool -called_from_builtin (void) -{ - octave_function *fcn = octave_call_stack::caller (); - - // FIXME: we probably need a better check here, or some other - // mechanism to avoid overloaded functions when builtin is used. - // For example, what if someone overloads the builtin function? - // Also, are there other places where using builtin is not properly - // avoiding dispatch? - - return (fcn && fcn->name () == "builtin"); -} - Matrix octave_class::size (void) {