# HG changeset patch # User John W. Eaton # Date 1600322957 14400 # Thu Sep 17 02:09:17 2020 -0400 # Branch stable # Node ID 2e555efb79e3c96c11c741f3e3008ed980e8cdd7 # Parent 443add3fa72b1c2681598bfe0977880e1420debd eliminate has_magic_end and includes_magic_end functions * pt-arg-list.h, pt-arg-list.cc (tree_argument_list::has_magic_end, tree_argument_list::includes_magic_end): Delete member functions that are no longer used. (tree_argument_list::m_list_includes_magic_end): Delete member variable. * pt-exp.h (tree_expression::has_magic_end): Delete pure virtual function and all implementations in derived classes. diff --git a/libinterp/parse-tree/pt-arg-list.cc b/libinterp/parse-tree/pt-arg-list.cc --- a/libinterp/parse-tree/pt-arg-list.cc +++ b/libinterp/parse-tree/pt-arg-list.cc @@ -53,26 +53,11 @@ namespace octave } } - bool - tree_argument_list::has_magic_end (void) const - { - for (const tree_expression *elt : *this) - { - if (elt && ! elt->is_index_expression () && elt->has_magic_end ()) - return true; - } - - return false; - } - void tree_argument_list::append (const element_type& s) { base_list::append (s); - if (! m_list_includes_magic_end && s && s->has_magic_end ()) - m_list_includes_magic_end = true; - if (! m_list_includes_magic_tilde && s && s->is_identifier ()) { tree_identifier *id = dynamic_cast (s); @@ -157,7 +142,6 @@ namespace octave { tree_argument_list *new_list = new tree_argument_list (); - new_list->m_list_includes_magic_end = m_list_includes_magic_end; new_list->m_simple_assign_lhs = m_simple_assign_lhs; for (const tree_expression *elt : *this) diff --git a/libinterp/parse-tree/pt-arg-list.h b/libinterp/parse-tree/pt-arg-list.h --- a/libinterp/parse-tree/pt-arg-list.h +++ b/libinterp/parse-tree/pt-arg-list.h @@ -54,12 +54,11 @@ namespace octave typedef tree_expression* element_type; tree_argument_list (void) - : m_list_includes_magic_end (false), m_list_includes_magic_tilde (false), - m_simple_assign_lhs (false) { } + : m_list_includes_magic_tilde (false), m_simple_assign_lhs (false) + { } tree_argument_list (tree_expression *t) - : m_list_includes_magic_end (false), m_list_includes_magic_tilde (false), - m_simple_assign_lhs (false) + : m_list_includes_magic_tilde (false), m_simple_assign_lhs (false) { append (t); } // No copying! @@ -70,15 +69,6 @@ namespace octave ~tree_argument_list (void); - // FIXME: This does not recursively check elements of the list - // that are also index expressions. - bool has_magic_end (void) const; - - bool includes_magic_end (void) const - { - return m_list_includes_magic_end; - } - bool has_magic_tilde (void) const { return m_list_includes_magic_tilde; @@ -120,8 +110,6 @@ namespace octave private: - bool m_list_includes_magic_end; - bool m_list_includes_magic_tilde; bool m_simple_assign_lhs; diff --git a/libinterp/parse-tree/pt-array-list.cc b/libinterp/parse-tree/pt-array-list.cc --- a/libinterp/parse-tree/pt-array-list.cc +++ b/libinterp/parse-tree/pt-array-list.cc @@ -58,20 +58,6 @@ namespace octave return true; } - bool - tree_array_list::has_magic_end (void) const - { - for (const tree_argument_list *elt : *this) - { - octave_quit (); - - if (elt && elt->has_magic_end ()) - return true; - } - - return false; - } - void tree_array_list::copy_base (const tree_array_list& array_list) { diff --git a/libinterp/parse-tree/pt-array-list.h b/libinterp/parse-tree/pt-array-list.h --- a/libinterp/parse-tree/pt-array-list.h +++ b/libinterp/parse-tree/pt-array-list.h @@ -68,8 +68,6 @@ namespace octave bool all_elements_are_constant (void) const; - bool has_magic_end (void) const; - // FIXME: should we import the functions from the base class and // overload them here, or should we use a different name so we don't // have to do this? Without the using declaration or a name change, diff --git a/libinterp/parse-tree/pt-assign.h b/libinterp/parse-tree/pt-assign.h --- a/libinterp/parse-tree/pt-assign.h +++ b/libinterp/parse-tree/pt-assign.h @@ -68,8 +68,6 @@ namespace octave ~tree_simple_assignment (void); - bool has_magic_end (void) const { return (m_rhs && m_rhs->has_magic_end ()); } - bool rvalue_ok (void) const { return true; } bool is_assignment_expression (void) const { return true; } @@ -141,11 +139,6 @@ namespace octave ~tree_multi_assignment (void); - bool has_magic_end (void) const - { - return (m_rhs && m_rhs->has_magic_end ()); - } - bool is_assignment_expression (void) const { return true; } bool rvalue_ok (void) const { return true; } diff --git a/libinterp/parse-tree/pt-binop.h b/libinterp/parse-tree/pt-binop.h --- a/libinterp/parse-tree/pt-binop.h +++ b/libinterp/parse-tree/pt-binop.h @@ -85,12 +85,6 @@ namespace octave } } - bool has_magic_end (void) const - { - return ((m_lhs && m_lhs->has_magic_end ()) - || (m_rhs && m_rhs->has_magic_end ())); - } - bool is_binary_expression (void) const { return true; } bool rvalue_ok (void) const { return true; } diff --git a/libinterp/parse-tree/pt-classdef.h b/libinterp/parse-tree/pt-classdef.h --- a/libinterp/parse-tree/pt-classdef.h +++ b/libinterp/parse-tree/pt-classdef.h @@ -68,8 +68,6 @@ namespace octave std::string class_name (void) const { return m_class_name; } - bool has_magic_end (void) const { return false; } - tree_superclass_ref * dup (symbol_scope& scope) const; octave_value evaluate (tree_evaluator& tw, int nargout = 1) @@ -115,8 +113,6 @@ namespace octave std::string class_name (void) const { return m_class_name; } - bool has_magic_end (void) const { return false; } - tree_metaclass_query * dup (symbol_scope& scope) const; octave_value evaluate (tree_evaluator&, int nargout = 1); diff --git a/libinterp/parse-tree/pt-colon.h b/libinterp/parse-tree/pt-colon.h --- a/libinterp/parse-tree/pt-colon.h +++ b/libinterp/parse-tree/pt-colon.h @@ -75,13 +75,6 @@ namespace octave delete m_increment; } - bool has_magic_end (void) const - { - return ((m_base && m_base->has_magic_end ()) - || (m_limit && m_limit->has_magic_end ()) - || (m_increment && m_increment->has_magic_end ())); - } - void preserve_base (void) { m_save_base = true; } bool rvalue_ok (void) const { return true; } diff --git a/libinterp/parse-tree/pt-const.h b/libinterp/parse-tree/pt-const.h --- a/libinterp/parse-tree/pt-const.h +++ b/libinterp/parse-tree/pt-const.h @@ -69,8 +69,6 @@ namespace octave ~tree_constant (void) = default; - bool has_magic_end (void) const { return false; } - // Type. It would be nice to eliminate the need for this. bool is_constant (void) const { return true; } diff --git a/libinterp/parse-tree/pt-exp.h b/libinterp/parse-tree/pt-exp.h --- a/libinterp/parse-tree/pt-exp.h +++ b/libinterp/parse-tree/pt-exp.h @@ -59,8 +59,6 @@ namespace octave virtual ~tree_expression (void) = default; - virtual bool has_magic_end (void) const = 0; - virtual tree_expression * dup (symbol_scope& scope) const = 0; virtual bool is_constant (void) const { return false; } diff --git a/libinterp/parse-tree/pt-fcn-handle.h b/libinterp/parse-tree/pt-fcn-handle.h --- a/libinterp/parse-tree/pt-fcn-handle.h +++ b/libinterp/parse-tree/pt-fcn-handle.h @@ -63,8 +63,6 @@ namespace octave ~tree_fcn_handle (void) = default; - bool has_magic_end (void) const { return false; } - void print (std::ostream& os, bool pr_as_read_syntax = false, bool pr_orig_txt = true); @@ -121,8 +119,6 @@ namespace octave ~tree_anon_fcn_handle (void); - bool has_magic_end (void) const { return false; } - bool rvalue_ok (void) const { return true; } tree_parameter_list * parameter_list (void) const diff --git a/libinterp/parse-tree/pt-id.h b/libinterp/parse-tree/pt-id.h --- a/libinterp/parse-tree/pt-id.h +++ b/libinterp/parse-tree/pt-id.h @@ -68,8 +68,6 @@ namespace octave ~tree_identifier (void) = default; - bool has_magic_end (void) const { return (name () == "end"); } - bool is_identifier (void) const { return true; } std::string name (void) const { return m_sym.name (); } diff --git a/libinterp/parse-tree/pt-idx.cc b/libinterp/parse-tree/pt-idx.cc --- a/libinterp/parse-tree/pt-idx.cc +++ b/libinterp/parse-tree/pt-idx.cc @@ -126,18 +126,6 @@ namespace octave } } - bool - tree_index_expression::has_magic_end (void) const - { - for (const tree_argument_list *elt : m_args) - { - if (elt && elt->has_magic_end ()) - return true; - } - - return false; - } - // This is useful for printing the name of the variable in an indexed // assignment. diff --git a/libinterp/parse-tree/pt-idx.h b/libinterp/parse-tree/pt-idx.h --- a/libinterp/parse-tree/pt-idx.h +++ b/libinterp/parse-tree/pt-idx.h @@ -70,8 +70,6 @@ namespace octave ~tree_index_expression (void); - bool has_magic_end (void) const; - void append (tree_argument_list *lst = nullptr, char t = '('); void append (const std::string& n); diff --git a/libinterp/parse-tree/pt-unop.h b/libinterp/parse-tree/pt-unop.h --- a/libinterp/parse-tree/pt-unop.h +++ b/libinterp/parse-tree/pt-unop.h @@ -69,8 +69,6 @@ namespace octave bool is_unary_expression (void) const { return true; } - bool has_magic_end (void) const { return (m_op && m_op->has_magic_end ()); } - tree_expression * operand (void) { return m_op; } std::string oper (void) const;