# HG changeset patch # User Fernando Alvarruiz # Date 1600553514 -7200 # Sun Sep 20 00:11:54 2020 +0200 # Branch stable # Node ID 0af1a991f53b916ccf362bf53b777724a46469f9 # Parent 9fa6b69ac96803096ec0196348adbc7495c6d111 Fix issue with expression obj.data(end) called inside a method of obj diff -r 9fa6b69ac968 -r 0af1a991f53b libinterp/parse-tree/pt-eval.cc --- a/libinterp/parse-tree/pt-eval.cc Wed Sep 16 15:01:08 2020 -0400 +++ b/libinterp/parse-tree/pt-eval.cc Sun Sep 20 00:11:54 2020 +0200 @@ -4135,19 +4135,6 @@ { try { - // FIXME: Why do we have to set dispatch_class here? Is - // there some reason that calling subsref on an object - // wouldn't already do that job? - - unwind_action - act ([this] (const std::string& cls) - { - set_dispatch_class (cls); - }, get_dispatch_class ()); - - if (m_indexed_object.isobject ()) - set_dispatch_class (m_indexed_object.class_name ()); - // End is only valid inside argument lists used for // indexing. The dispatch class is set by the function that // evaluates the argument list. diff -r 9fa6b69ac968 -r 0af1a991f53b libinterp/parse-tree/pt-id.cc --- a/libinterp/parse-tree/pt-id.cc Wed Sep 16 15:01:08 2020 -0400 +++ b/libinterp/parse-tree/pt-id.cc Sun Sep 20 00:11:54 2020 +0200 @@ -127,7 +127,10 @@ if (fcn && ! (is_postfix_indexed () && fcn->accepts_postfix_index (postfix_index ()))) { - retval = fcn->call (tw, nargout); + if (has_magic_end()) + retval = tw.evaluate_end_expression(octave_value_list()); + else + retval = fcn->call (tw, nargout); } else { diff -r 9fa6b69ac968 -r 0af1a991f53b libinterp/parse-tree/pt-idx.cc --- a/libinterp/parse-tree/pt-idx.cc Wed Sep 16 15:01:08 2020 -0400 +++ b/libinterp/parse-tree/pt-idx.cc Sun Sep 20 00:11:54 2020 +0200 @@ -470,15 +470,14 @@ // example). unwind_action - act ([&tw] (const std::string& cls, const octave_value& val, + act ([&tw] (const octave_value& val, const std::string& index_type, const std::list& index_list) { - tw.set_dispatch_class (cls); tw.set_indexed_object (val); tw.set_index_list (index_type, index_list); }, - tw.get_dispatch_class (), tw.indexed_object (), + tw.indexed_object (), tw.index_type (), tw.index_list ()); tw.set_indexed_object (); @@ -491,9 +490,6 @@ octave_value partial_expr_val = base_expr_val; - if (partial_expr_val.isobject ()) - tw.set_dispatch_class (partial_expr_val.class_name ()); - for (int i = beg; i < n; i++) { if (i > beg) @@ -541,9 +537,6 @@ // here? indexing_object = true; - - if (partial_expr_val.isobject ()) - tw.set_dispatch_class (partial_expr_val.class_name ()); } } catch (index_exception& e)