Mercurial > octave
changeset 28805:2219b0ed8754 stable
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.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 17 Sep 2020 02:09:17 -0400 |
parents | 3719f5d452d4 |
children | d5efdf5cfc56 f0588f913755 |
files | libinterp/parse-tree/pt-arg-list.cc libinterp/parse-tree/pt-arg-list.h libinterp/parse-tree/pt-array-list.cc libinterp/parse-tree/pt-array-list.h libinterp/parse-tree/pt-assign.h libinterp/parse-tree/pt-binop.h libinterp/parse-tree/pt-classdef.h libinterp/parse-tree/pt-colon.h libinterp/parse-tree/pt-const.h libinterp/parse-tree/pt-exp.h libinterp/parse-tree/pt-fcn-handle.h libinterp/parse-tree/pt-id.h libinterp/parse-tree/pt-idx.cc libinterp/parse-tree/pt-idx.h libinterp/parse-tree/pt-unop.h |
diffstat | 15 files changed, 3 insertions(+), 97 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/parse-tree/pt-arg-list.cc Mon Sep 21 10:45:18 2020 -0400 +++ b/libinterp/parse-tree/pt-arg-list.cc Thu Sep 17 02:09:17 2020 -0400 @@ -53,26 +53,11 @@ } } - 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<tree_expression *>::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<tree_identifier *> (s); @@ -157,7 +142,6 @@ { 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)
--- a/libinterp/parse-tree/pt-arg-list.h Mon Sep 21 10:45:18 2020 -0400 +++ b/libinterp/parse-tree/pt-arg-list.h Thu Sep 17 02:09:17 2020 -0400 @@ -54,12 +54,11 @@ 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 @@ ~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 @@ private: - bool m_list_includes_magic_end; - bool m_list_includes_magic_tilde; bool m_simple_assign_lhs;
--- a/libinterp/parse-tree/pt-array-list.cc Mon Sep 21 10:45:18 2020 -0400 +++ b/libinterp/parse-tree/pt-array-list.cc Thu Sep 17 02:09:17 2020 -0400 @@ -58,20 +58,6 @@ 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) {
--- a/libinterp/parse-tree/pt-array-list.h Mon Sep 21 10:45:18 2020 -0400 +++ b/libinterp/parse-tree/pt-array-list.h Thu Sep 17 02:09:17 2020 -0400 @@ -68,8 +68,6 @@ 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,
--- a/libinterp/parse-tree/pt-assign.h Mon Sep 21 10:45:18 2020 -0400 +++ b/libinterp/parse-tree/pt-assign.h Thu Sep 17 02:09:17 2020 -0400 @@ -68,8 +68,6 @@ ~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 @@ ~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; }
--- a/libinterp/parse-tree/pt-binop.h Mon Sep 21 10:45:18 2020 -0400 +++ b/libinterp/parse-tree/pt-binop.h Thu Sep 17 02:09:17 2020 -0400 @@ -85,12 +85,6 @@ } } - 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; }
--- a/libinterp/parse-tree/pt-classdef.h Mon Sep 21 10:45:18 2020 -0400 +++ b/libinterp/parse-tree/pt-classdef.h Thu Sep 17 02:09:17 2020 -0400 @@ -68,8 +68,6 @@ 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 @@ 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);
--- a/libinterp/parse-tree/pt-colon.h Mon Sep 21 10:45:18 2020 -0400 +++ b/libinterp/parse-tree/pt-colon.h Thu Sep 17 02:09:17 2020 -0400 @@ -75,13 +75,6 @@ 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; }
--- a/libinterp/parse-tree/pt-const.h Mon Sep 21 10:45:18 2020 -0400 +++ b/libinterp/parse-tree/pt-const.h Thu Sep 17 02:09:17 2020 -0400 @@ -69,8 +69,6 @@ ~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; }
--- a/libinterp/parse-tree/pt-exp.h Mon Sep 21 10:45:18 2020 -0400 +++ b/libinterp/parse-tree/pt-exp.h Thu Sep 17 02:09:17 2020 -0400 @@ -59,8 +59,6 @@ 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; }
--- a/libinterp/parse-tree/pt-fcn-handle.h Mon Sep 21 10:45:18 2020 -0400 +++ b/libinterp/parse-tree/pt-fcn-handle.h Thu Sep 17 02:09:17 2020 -0400 @@ -63,8 +63,6 @@ ~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 @@ ~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
--- a/libinterp/parse-tree/pt-id.h Mon Sep 21 10:45:18 2020 -0400 +++ b/libinterp/parse-tree/pt-id.h Thu Sep 17 02:09:17 2020 -0400 @@ -68,8 +68,6 @@ ~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 (); }
--- a/libinterp/parse-tree/pt-idx.cc Mon Sep 21 10:45:18 2020 -0400 +++ b/libinterp/parse-tree/pt-idx.cc Thu Sep 17 02:09:17 2020 -0400 @@ -126,18 +126,6 @@ } } - 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.
--- a/libinterp/parse-tree/pt-idx.h Mon Sep 21 10:45:18 2020 -0400 +++ b/libinterp/parse-tree/pt-idx.h Thu Sep 17 02:09:17 2020 -0400 @@ -70,8 +70,6 @@ ~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);
--- a/libinterp/parse-tree/pt-unop.h Mon Sep 21 10:45:18 2020 -0400 +++ b/libinterp/parse-tree/pt-unop.h Thu Sep 17 02:09:17 2020 -0400 @@ -69,8 +69,6 @@ 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;