Mercurial > octave
changeset 23601:a3898679d459
eliminate unused dup methods in parse tree classes
Now that anonymous functions can only contain a single expression,
none of these are needed.
* pt-cmd.cc: Delete file containing only unused methods.
* libinterp/parse-tree/module.mk: Update.
* pt-classdef.cc, pt-classdef.h, pt-cmd.h, pt-decl.cc, pt-decl.h,
pt-except.cc, pt-except.h, pt-jump.cc, pt-jump.h, pt-loop.cc,
pt-loop.h, pt-misc.cc, pt-misc.h, pt-select.cc, pt-select.h,
pt-stmt.cc, pt-stmt.h: Delete unused dup methods.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sun, 11 Jun 2017 16:57:00 -0400 |
parents | db947ba52118 |
children | 214cb58ccc1c |
files | libinterp/parse-tree/module.mk libinterp/parse-tree/pt-classdef.cc libinterp/parse-tree/pt-classdef.h libinterp/parse-tree/pt-cmd.cc libinterp/parse-tree/pt-cmd.h libinterp/parse-tree/pt-decl.cc libinterp/parse-tree/pt-decl.h libinterp/parse-tree/pt-except.cc libinterp/parse-tree/pt-except.h libinterp/parse-tree/pt-jump.cc libinterp/parse-tree/pt-jump.h libinterp/parse-tree/pt-loop.cc libinterp/parse-tree/pt-loop.h libinterp/parse-tree/pt-misc.cc libinterp/parse-tree/pt-misc.h libinterp/parse-tree/pt-select.cc libinterp/parse-tree/pt-select.h libinterp/parse-tree/pt-stmt.cc libinterp/parse-tree/pt-stmt.h |
diffstat | 19 files changed, 0 insertions(+), 358 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/parse-tree/module.mk Sun Jun 11 16:37:26 2017 -0400 +++ b/libinterp/parse-tree/module.mk Sun Jun 11 16:57:00 2017 -0400 @@ -62,7 +62,6 @@ %reldir%/pt-cell.cc \ %reldir%/pt-check.cc \ %reldir%/pt-classdef.cc \ - %reldir%/pt-cmd.cc \ %reldir%/pt-colon.cc \ %reldir%/pt-const.cc \ %reldir%/pt-decl.cc \
--- a/libinterp/parse-tree/pt-classdef.cc Sun Jun 11 16:37:26 2017 -0400 +++ b/libinterp/parse-tree/pt-classdef.cc Sun Jun 11 16:57:00 2017 -0400 @@ -154,12 +154,4 @@ return 0; } - - tree_classdef * - tree_classdef::dup (symbol_table::scope_id, - symbol_table::context_id) const - { - // FIXME - return 0; - } }
--- a/libinterp/parse-tree/pt-classdef.h Sun Jun 11 16:37:26 2017 -0400 +++ b/libinterp/parse-tree/pt-classdef.h Sun Jun 11 16:57:00 2017 -0400 @@ -674,9 +674,6 @@ octave_function * make_meta_class (interpreter& interp, bool is_at_folder = false); - tree_classdef * dup (symbol_table::scope_id scope, - symbol_table::context_id context) const; - void accept (tree_walker& tw) { tw.visit_classdef (*this);
--- a/libinterp/parse-tree/pt-cmd.cc Sun Jun 11 16:37:26 2017 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* - -Copyright (C) 1994-2017 John W. Eaton - -This file is part of Octave. - -Octave is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 3 of the License, or -(at your option) any later version. - -Octave is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Octave; see the file COPYING. If not, see -<http://www.gnu.org/licenses/>. - -*/ - -#if defined (HAVE_CONFIG_H) -# include "config.h" -#endif - -#include "pt-cmd.h" -#include "pt-walk.h" - -namespace octave -{ - // No-op. - - tree_command * - tree_no_op_command::dup (symbol_table::scope_id, - symbol_table::context_id) const - { - return new tree_no_op_command (orig_cmd, is_end_of_file (), - line (), column ()); - } - - // Function definition. - - tree_command * - tree_function_def::dup (symbol_table::scope_id, - symbol_table::context_id) const - { - return new tree_function_def (fcn, line (), column ()); - } -}
--- a/libinterp/parse-tree/pt-cmd.h Sun Jun 11 16:37:26 2017 -0400 +++ b/libinterp/parse-tree/pt-cmd.h Sun Jun 11 16:57:00 2017 -0400 @@ -51,9 +51,6 @@ tree_command& operator = (const tree_command&) = delete; virtual ~tree_command (void) = default; - - virtual tree_command * dup (symbol_table::scope_id, - symbol_table::context_id context) const = 0; }; // No-op. @@ -74,9 +71,6 @@ ~tree_no_op_command (void) = default; - tree_command * dup (symbol_table::scope_id scope, - symbol_table::context_id context) const; - void accept (tree_walker& tw) { tw.visit_no_op_command (*this); @@ -115,9 +109,6 @@ ~tree_function_def (void) = default; - tree_command * dup (symbol_table::scope_id scope, - symbol_table::context_id context) const; - void accept (tree_walker& tw) { tw.visit_function_def (*this);
--- a/libinterp/parse-tree/pt-decl.cc Sun Jun 11 16:37:26 2017 -0400 +++ b/libinterp/parse-tree/pt-decl.cc Sun Jun 11 16:57:00 2017 -0400 @@ -57,18 +57,6 @@ // Initializer lists for declaration statements. - tree_decl_init_list * - tree_decl_init_list::dup (symbol_table::scope_id scope, - symbol_table::context_id context) const - { - tree_decl_init_list *new_dil = new tree_decl_init_list (); - - for (const tree_decl_elt *elt : *this) - new_dil->append (elt ? elt->dup (scope, context) : 0); - - return new_dil; - } - // Declaration commands (global, static). tree_decl_command::tree_decl_command (const std::string& n, @@ -91,14 +79,4 @@ { delete init_list; } - - tree_command * - tree_decl_command::dup (symbol_table::scope_id scope, - symbol_table::context_id context) const - { - tree_decl_init_list *new_init_list - = init_list ? init_list->dup (scope, context) : 0; - - return new tree_decl_command (name (), new_init_list, line (), column ()); - } }
--- a/libinterp/parse-tree/pt-decl.h Sun Jun 11 16:37:26 2017 -0400 +++ b/libinterp/parse-tree/pt-decl.h Sun Jun 11 16:57:00 2017 -0400 @@ -148,9 +148,6 @@ elt->mark_persistent (); } - tree_decl_init_list * dup (symbol_table::scope_id scope, - symbol_table::context_id context) const; - void accept (tree_walker& tw) { tw.visit_decl_init_list (*this); @@ -193,9 +190,6 @@ std::string name (void) const { return cmd_name; } - tree_command *dup (symbol_table::scope_id scope, - symbol_table::context_id context) const; - void accept (tree_walker& tw) { tw.visit_decl_command (*this);
--- a/libinterp/parse-tree/pt-except.cc Sun Jun 11 16:37:26 2017 -0400 +++ b/libinterp/parse-tree/pt-except.cc Sun Jun 11 16:57:00 2017 -0400 @@ -54,20 +54,6 @@ delete trail_comm; } - tree_command * - tree_try_catch_command::dup (symbol_table::scope_id scope, - symbol_table::context_id context) const - { - return new - tree_try_catch_command (try_code ? try_code->dup (scope, context) : 0, - catch_code ? catch_code->dup (scope, context) : 0, - expr_id ? expr_id->dup (scope, context) : 0, - lead_comm ? lead_comm->dup () : 0, - mid_comm ? mid_comm->dup () : 0, - trail_comm ? trail_comm->dup () : 0, - line (), column ()); - } - // Simple exception handling. tree_unwind_protect_command::~tree_unwind_protect_command (void) @@ -78,17 +64,4 @@ delete mid_comm; delete trail_comm; } - - tree_command * - tree_unwind_protect_command::dup (symbol_table::scope_id scope, - symbol_table::context_id context) const - { - return new tree_unwind_protect_command - (unwind_protect_code ? unwind_protect_code->dup (scope, context) : 0, - cleanup_code ? cleanup_code->dup (scope, context) : 0, - lead_comm ? lead_comm->dup () : 0, - mid_comm ? mid_comm->dup () : 0, - trail_comm ? trail_comm->dup () : 0, - line (), column ()); - } }
--- a/libinterp/parse-tree/pt-except.h Sun Jun 11 16:37:26 2017 -0400 +++ b/libinterp/parse-tree/pt-except.h Sun Jun 11 16:57:00 2017 -0400 @@ -74,9 +74,6 @@ octave_comment_list * trailing_comment (void) { return trail_comm; } - tree_command * dup (symbol_table::scope_id scope, - symbol_table::context_id context) const; - void accept (tree_walker& tw) { tw.visit_try_catch_command (*this); @@ -141,9 +138,6 @@ octave_comment_list * trailing_comment (void) { return trail_comm; } - tree_command * dup (symbol_table::scope_id scope, - symbol_table::context_id context) const; - void accept (tree_walker& tw) { tw.visit_unwind_protect_command (*this);
--- a/libinterp/parse-tree/pt-jump.cc Sun Jun 11 16:37:26 2017 -0400 +++ b/libinterp/parse-tree/pt-jump.cc Sun Jun 11 16:57:00 2017 -0400 @@ -39,34 +39,13 @@ // Nonzero means we're breaking out of a loop or function body. int tree_break_command::breaking = 0; - tree_command * - tree_break_command::dup (symbol_table::scope_id, - symbol_table::context_id) const - { - return new tree_break_command (line (), column ()); - } - // Continue. // Nonzero means we're jumping to the end of a loop. int tree_continue_command::continuing = 0; - tree_command * - tree_continue_command::dup (symbol_table::scope_id, - symbol_table::context_id) const - { - return new tree_continue_command (line (), column ()); - } - // Return. // Nonzero means we're returning from a function. int tree_return_command::returning = 0; - - tree_command * - tree_return_command::dup (symbol_table::scope_id, - symbol_table::context_id) const - { - return new tree_return_command (line (), column ()); - } }
--- a/libinterp/parse-tree/pt-jump.h Sun Jun 11 16:37:26 2017 -0400 +++ b/libinterp/parse-tree/pt-jump.h Sun Jun 11 16:57:00 2017 -0400 @@ -48,9 +48,6 @@ ~tree_break_command (void) = default; - tree_command * dup (symbol_table::scope_id scope, - symbol_table::context_id context) const; - void accept (tree_walker& tw) { tw.visit_break_command (*this); @@ -76,9 +73,6 @@ ~tree_continue_command (void) = default; - tree_command * dup (symbol_table::scope_id scope, - symbol_table::context_id context) const; - void accept (tree_walker& tw) { tw.visit_continue_command (*this); @@ -104,9 +98,6 @@ ~tree_return_command (void) = default; - tree_command * dup (symbol_table::scope_id scope, - symbol_table::context_id context) const; - void accept (tree_walker& tw) { tw.visit_return_command (*this);
--- a/libinterp/parse-tree/pt-loop.cc Sun Jun 11 16:37:26 2017 -0400 +++ b/libinterp/parse-tree/pt-loop.cc Sun Jun 11 16:57:00 2017 -0400 @@ -57,30 +57,6 @@ #endif } - tree_command * - tree_while_command::dup (symbol_table::scope_id scope, - symbol_table::context_id context) const - { - return new tree_while_command (expr ? expr->dup (scope, context) : 0, - list ? list->dup (scope, context) : 0, - lead_comm ? lead_comm->dup () : 0, - trail_comm ? trail_comm->dup (): 0, - line (), column ()); - } - - // Do-Until - - tree_command * - tree_do_until_command::dup (symbol_table::scope_id scope, - symbol_table::context_id context) const - { - return new tree_do_until_command (expr ? expr->dup (scope, context) : 0, - list ? list->dup (scope, context) : 0, - lead_comm ? lead_comm->dup () : 0, - trail_comm ? trail_comm->dup (): 0, - line (), column ()); - } - // For. tree_simple_for_command::~tree_simple_for_command (void) @@ -96,19 +72,6 @@ #endif } - tree_command * - tree_simple_for_command::dup (symbol_table::scope_id scope, - symbol_table::context_id context) const - { - return new tree_simple_for_command - (parallel, lhs ? lhs->dup (scope, context) : 0, - expr ? expr->dup (scope, context) : 0, - maxproc ? maxproc->dup (scope, context) : 0, - list ? list->dup (scope, context) : 0, - lead_comm ? lead_comm->dup () : 0, - trail_comm ? trail_comm->dup () : 0, line (), column ()); - } - tree_complex_for_command::~tree_complex_for_command (void) { delete lhs; @@ -117,16 +80,4 @@ delete lead_comm; delete trail_comm; } - - tree_command * - tree_complex_for_command::dup (symbol_table::scope_id scope, - symbol_table::context_id context) const - { - return new tree_complex_for_command (lhs ? lhs->dup (scope, context) : 0, - expr ? expr->dup (scope, context) : 0, - list ? list->dup (scope, context) : 0, - lead_comm ? lead_comm->dup () : 0, - trail_comm ? trail_comm->dup () : 0, - line (), column ()); - } }
--- a/libinterp/parse-tree/pt-loop.h Sun Jun 11 16:37:26 2017 -0400 +++ b/libinterp/parse-tree/pt-loop.h Sun Jun 11 16:57:00 2017 -0400 @@ -92,9 +92,6 @@ octave_comment_list * trailing_comment (void) { return trail_comm; } - tree_command * dup (symbol_table::scope_id scope, - symbol_table::context_id context) const; - void accept (tree_walker& tw) { tw.visit_while_command (*this); @@ -164,9 +161,6 @@ ~tree_do_until_command (void) = default; - tree_command * dup (symbol_table::scope_id scope, - symbol_table::context_id context) const; - void accept (tree_walker& tw) { tw.visit_do_until_command (*this); @@ -224,9 +218,6 @@ octave_comment_list * trailing_comment (void) { return trail_comm; } - tree_command * dup (symbol_table::scope_id scope, - symbol_table::context_id context) const; - void accept (tree_walker& tw) { tw.visit_simple_for_command (*this); @@ -309,9 +300,6 @@ octave_comment_list * trailing_comment (void) { return trail_comm; } - tree_command * dup (symbol_table::scope_id scope, - symbol_table::context_id context) const; - void accept (tree_walker& tw) { tw.visit_complex_for_command (*this);
--- a/libinterp/parse-tree/pt-misc.cc Sun Jun 11 16:37:26 2017 -0400 +++ b/libinterp/parse-tree/pt-misc.cc Sun Jun 11 16:57:00 2017 -0400 @@ -166,16 +166,4 @@ erase (p); } } - - tree_return_list * - tree_return_list::dup (symbol_table::scope_id scope, - symbol_table::context_id context) const - { - tree_return_list *new_list = new tree_return_list (); - - for (const tree_index_expression *elt : *this) - new_list->append (elt->dup (scope, context)); - - return new_list; - } }
--- a/libinterp/parse-tree/pt-misc.h Sun Jun 11 16:37:26 2017 -0400 +++ b/libinterp/parse-tree/pt-misc.h Sun Jun 11 16:57:00 2017 -0400 @@ -114,9 +114,6 @@ ~tree_return_list (void); - tree_return_list * dup (symbol_table::scope_id scope, - symbol_table::context_id context) const; - void accept (tree_walker& tw) { tw.visit_return_list (*this);
--- a/libinterp/parse-tree/pt-select.cc Sun Jun 11 16:37:26 2017 -0400 +++ b/libinterp/parse-tree/pt-select.cc Sun Jun 11 16:57:00 2017 -0400 @@ -46,29 +46,6 @@ delete lead_comm; } - tree_if_clause * - tree_if_clause::dup (symbol_table::scope_id scope, - symbol_table::context_id context) const - { - return new tree_if_clause (expr ? expr->dup (scope, context) : 0, - list ? list->dup (scope, context) : 0, - lead_comm ? lead_comm->dup () : 0); - } - - // List of if commands. - - tree_if_command_list * - tree_if_command_list::dup (symbol_table::scope_id scope, - symbol_table::context_id context) const - { - tree_if_command_list *new_icl = new tree_if_command_list (); - - for (const tree_if_clause *elt : *this) - new_icl->append (elt ? elt->dup (scope, context) : 0); - - return new_icl; - } - // If. tree_if_command::~tree_if_command (void) @@ -78,16 +55,6 @@ delete trail_comm; } - tree_command * - tree_if_command::dup (symbol_table::scope_id scope, - symbol_table::context_id context) const - { - return new tree_if_command (list ? list->dup (scope, context) : 0, - lead_comm ? lead_comm->dup () : 0, - trail_comm ? trail_comm->dup () : 0, - line (), column ()); - } - // Switch cases. tree_switch_case::~tree_switch_case (void) @@ -97,29 +64,6 @@ delete lead_comm; } - tree_switch_case * - tree_switch_case::dup (symbol_table::scope_id scope, - symbol_table::context_id context) const - { - return new tree_switch_case (label ? label->dup (scope, context) : 0, - list ? list->dup (scope, context) : 0, - lead_comm ? lead_comm->dup () : 0); - } - - // List of switch cases. - - tree_switch_case_list * - tree_switch_case_list::dup (symbol_table::scope_id scope, - symbol_table::context_id context) const - { - tree_switch_case_list *new_scl = new tree_switch_case_list (); - - for (const tree_switch_case *elt : *this) - new_scl->append (elt ? elt->dup (scope, context) : 0); - - return new_scl; - } - // Switch. tree_switch_command::~tree_switch_command (void) @@ -129,15 +73,4 @@ delete lead_comm; delete trail_comm; } - - tree_command * - tree_switch_command::dup (symbol_table::scope_id scope, - symbol_table::context_id context) const - { - return new tree_switch_command (expr ? expr->dup (scope, context) : 0, - list ? list->dup (scope, context) : 0, - lead_comm ? lead_comm->dup () : 0, - trail_comm ? trail_comm->dup () : 0, - line (), column ()); - } }
--- a/libinterp/parse-tree/pt-select.h Sun Jun 11 16:37:26 2017 -0400 +++ b/libinterp/parse-tree/pt-select.h Sun Jun 11 16:57:00 2017 -0400 @@ -70,9 +70,6 @@ octave_comment_list * leading_comment (void) { return lead_comm; } - tree_if_clause * dup (symbol_table::scope_id scope, - symbol_table::context_id context) const; - void accept (tree_walker& tw) { tw.visit_if_clause (*this); @@ -114,9 +111,6 @@ } } - tree_if_command_list * dup (symbol_table::scope_id scope, - symbol_table::context_id context) const; - void accept (tree_walker& tw) { tw.visit_if_command_list (*this); @@ -148,9 +142,6 @@ octave_comment_list * trailing_comment (void) { return trail_comm; } - tree_command * dup (symbol_table::scope_id scope, - symbol_table::context_id context) const; - void accept (tree_walker& tw) { tw.visit_if_command (*this); @@ -202,9 +193,6 @@ octave_comment_list * leading_comment (void) { return lead_comm; } - tree_switch_case * dup (symbol_table::scope_id scope, - symbol_table::context_id context) const; - void accept (tree_walker& tw) { tw.visit_switch_case (*this); @@ -246,9 +234,6 @@ } } - tree_switch_case_list * dup (symbol_table::scope_id scope, - symbol_table::context_id context) const; - void accept (tree_walker& tw) { tw.visit_switch_case_list (*this); @@ -285,9 +270,6 @@ octave_comment_list * trailing_comment (void) { return trail_comm; } - tree_command * dup (symbol_table::scope_id scope, - symbol_table::context_id context) const; - void accept (tree_walker& tw) { tw.visit_switch_command (*this);
--- a/libinterp/parse-tree/pt-stmt.cc Sun Jun 11 16:37:26 2017 -0400 +++ b/libinterp/parse-tree/pt-stmt.cc Sun Jun 11 16:57:00 2017 -0400 @@ -167,21 +167,6 @@ return retval; } - tree_statement * - tree_statement::dup (symbol_table::scope_id scope, - symbol_table::context_id context) const - { - tree_statement *new_stmt = new tree_statement (); - - new_stmt->cmd = (cmd ? cmd->dup (scope, context) : 0); - - new_stmt->expr = (expr ? expr->dup (scope, context) : 0); - - new_stmt->comm = (comm ? comm->dup () : 0); - - return new_stmt; - } - // Create a "breakpoint" tree-walker, and get it to "walk" this statement list // (FIXME: What does that do???) int @@ -296,18 +281,4 @@ return retval; } - - tree_statement_list * - tree_statement_list::dup (symbol_table::scope_id scope, - symbol_table::context_id context) const - { - tree_statement_list *new_list = new tree_statement_list (); - - new_list->function_body = function_body; - - for (const tree_statement *elt : *this) - new_list->append (elt ? elt->dup (scope, context) : 0); - - return new_list; - } }
--- a/libinterp/parse-tree/pt-stmt.h Sun Jun 11 16:37:26 2017 -0400 +++ b/libinterp/parse-tree/pt-stmt.h Sun Jun 11 16:57:00 2017 -0400 @@ -107,9 +107,6 @@ void set_expression (tree_expression *e) { expr = e; } - tree_statement * dup (symbol_table::scope_id scope, - symbol_table::context_id context) const; - void accept (tree_walker& tw) { tw.visit_statement (*this); @@ -185,9 +182,6 @@ bp_table::intmap remove_all_breakpoints (const std::string& file); - tree_statement_list * dup (symbol_table::scope_id scope, - symbol_table::context_id context) const; - void accept (tree_walker& tw) { tw.visit_statement_list (*this);