# HG changeset patch # User John W. Eaton # Date 1236279025 18000 # Node ID 35cd375d4bb3c3d577bd3f01f1bbc25005315e02 # Parent 57c3155754d69c8a01d2ec90fe37b5914a6f5de9 make tree::dup functions const diff -r 57c3155754d6 -r 35cd375d4bb3 src/ChangeLog --- a/src/ChangeLog Thu Mar 05 09:37:59 2009 +0100 +++ b/src/ChangeLog Thu Mar 05 13:50:25 2009 -0500 @@ -1,3 +1,44 @@ +2009-03-05 John W. Eaton + + * pt-cell.cc, pt-cell.h (tree_cell::dup): Now const. + * comment-list.cc, comment-list.h (octave_comment_list::dup): Ditto. + * pt-arg-list.cc, pt-arg-list.h (tree_argument_list::dup): Ditto. + * pt-assign.cc, pt-assign.h (tree_simple_assignment::dup, + tree_multi_assignment::dup): Ditto. + * pt-binop.cc, pt-binop.h (tree_binary_expression::dup, + tree_boolean_expression::dup): Ditto. + * pt-cmd.cc, pt-cmd.h (tree_no_op_command::dup, + tree_function_def::dup): Ditto. + * pt-colon.cc, pt-colon.h (tree_colon_expression::dup): Ditto. + * pt-const.cc, pt-const.h (tree_constant::dup): Ditto. + * pt-decl.cc, pt-decl.h (tree_decl_elt::dup, tree_decl_init_list::dup, + tree_global_command::dup, tree_static_command::dup): Ditto. + * pt-except.cc, pt-except.h (tree_try_catch_command::dup, + tree_unwind_protect_command::dup): Ditto. + * pt-fcn-handle.cc, pt-fcn-handle.h (tree_fcn_handle::dup, + tree_anon_fcn_handle::dup): Ditto. + * pt-id.cc, pt-id.h (tree_identifier::dup): Ditto. + * pt-idx.cc, pt-idx.h (tree_index_expression::dup): Ditto. + * pt-jump.cc, pt-jump.h (tree_break_command::dup, + tree_continue_command::dup, tree_return_command::dup): Ditto. + * pt-loop.cc, pt-loop.h (tree_while_command::dup, + tree_do_until_command::dup, tree_simple_for_command::dup, + tree_complex_for_command::dup): Ditto. + * pt-mat.cc, pt-mat.h (tree_matrix::dup): Ditto. + * pt-misc.cc, pt-misc.h (tree_parameter_list::dup, + tree_return_list::dup): Ditto. + * pt-select.cc, pt-select.h (tree_if_clause::dup, + tree_if_command_list::dup, tree_if_command::dup, + tree_switch_case::dup, tree_switch_case_list::dup, + tree_switch_command::dup): Ditto. + * pt-stmt.cc, pt-stmt.h (tree_statement::dup, + tree_statement_list::dup): Ditto. + * pt-unop.cc, pt-unop.h (tree_prefix_expression::dup, + tree_postfix_expression::dup): Ditto. + * pt-fcn-handle.h (tree_anon_fcn_handle::parameter_list, + tree_anon_fcn_handle::return_list, tree_anon_fcn_handle::body, + tree_anon_fcn_handle::scope): Ditto. + 2009-03-05 Jaroslav Hajek * DLD-FUNCTIONS/sparse.cc (Fsparse): Handle diagonal and permutation diff -r 57c3155754d6 -r 35cd375d4bb3 src/comment-list.cc --- a/src/comment-list.cc Thu Mar 05 09:37:59 2009 +0100 +++ b/src/comment-list.cc Thu Mar 05 13:50:25 2009 -0500 @@ -32,13 +32,13 @@ octave_comment_buffer *octave_comment_buffer::instance = 0; octave_comment_list * -octave_comment_list::dup (void) +octave_comment_list::dup (void) const { octave_comment_list *new_cl = new octave_comment_list (); - for (iterator p = begin (); p != end (); p++) + for (const_iterator p = begin (); p != end (); p++) { - octave_comment_elt elt = *p; + const octave_comment_elt elt = *p; new_cl->append (elt); } diff -r 57c3155754d6 -r 35cd375d4bb3 src/comment-list.h --- a/src/comment-list.h Thu Mar 05 09:37:59 2009 +0100 +++ b/src/comment-list.h Thu Mar 05 13:50:25 2009 -0500 @@ -94,7 +94,7 @@ octave_comment_elt::comment_type t = octave_comment_elt::unknown) { append (octave_comment_elt (s, t)); } - octave_comment_list *dup (void); + octave_comment_list *dup (void) const; }; class diff -r 57c3155754d6 -r 35cd375d4bb3 src/pt-arg-list.cc --- a/src/pt-arg-list.cc Thu Mar 05 09:37:59 2009 +0100 +++ b/src/pt-arg-list.cc Thu Mar 05 13:50:25 2009 -0500 @@ -259,16 +259,16 @@ tree_argument_list * tree_argument_list::dup (symbol_table::scope_id scope, - symbol_table::context_id context) + symbol_table::context_id context) const { tree_argument_list *new_list = new tree_argument_list (); new_list->list_includes_magic_end = list_includes_magic_end; new_list->simple_assign_lhs = simple_assign_lhs; - for (iterator p = begin (); p != end (); p++) + for (const_iterator p = begin (); p != end (); p++) { - tree_expression *elt = *p; + const tree_expression *elt = *p; new_list->append (elt ? elt->dup (scope, context) : 0); } diff -r 57c3155754d6 -r 35cd375d4bb3 src/pt-arg-list.h --- a/src/pt-arg-list.h Thu Mar 05 09:37:59 2009 +0100 +++ b/src/pt-arg-list.h Thu Mar 05 13:50:25 2009 -0500 @@ -79,7 +79,7 @@ string_vector get_arg_names (void) const; tree_argument_list *dup (symbol_table::scope_id scope, - symbol_table::context_id context); + symbol_table::context_id context) const; void accept (tree_walker& tw); diff -r 57c3155754d6 -r 35cd375d4bb3 src/pt-assign.cc --- a/src/pt-assign.cc Thu Mar 05 09:37:59 2009 +0100 +++ b/src/pt-assign.cc Thu Mar 05 13:50:25 2009 -0500 @@ -269,7 +269,7 @@ tree_expression * tree_simple_assignment::dup (symbol_table::scope_id scope, - symbol_table::context_id context) + symbol_table::context_id context) const { tree_simple_assignment *new_sa = new tree_simple_assignment (lhs ? lhs->dup (scope, context) : 0, @@ -479,7 +479,7 @@ tree_expression * tree_multi_assignment::dup (symbol_table::scope_id scope, - symbol_table::context_id context) + symbol_table::context_id context) const { tree_multi_assignment *new_ma = new tree_multi_assignment (lhs ? lhs->dup (scope, context) : 0, diff -r 57c3155754d6 -r 35cd375d4bb3 src/pt-assign.h --- a/src/pt-assign.h Thu Mar 05 09:37:59 2009 +0100 +++ b/src/pt-assign.h Thu Mar 05 13:50:25 2009 -0500 @@ -73,7 +73,7 @@ tree_expression *right_hand_side (void) { return rhs; } tree_expression *dup (symbol_table::scope_id scope, - symbol_table::context_id context); + symbol_table::context_id context) const; void accept (tree_walker& tw); @@ -146,7 +146,7 @@ tree_expression *right_hand_side (void) { return rhs; } tree_expression *dup (symbol_table::scope_id scope, - symbol_table::context_id context); + symbol_table::context_id context) const; void accept (tree_walker& tw); diff -r 57c3155754d6 -r 35cd375d4bb3 src/pt-binop.cc --- a/src/pt-binop.cc Thu Mar 05 09:37:59 2009 +0100 +++ b/src/pt-binop.cc Thu Mar 05 13:50:25 2009 -0500 @@ -85,7 +85,7 @@ tree_expression * tree_binary_expression::dup (symbol_table::scope_id scope, - symbol_table::context_id context) + symbol_table::context_id context) const { tree_binary_expression *new_be = new tree_binary_expression (op_lhs ? op_lhs->dup (scope, context) : 0, @@ -196,7 +196,7 @@ tree_expression * tree_boolean_expression::dup (symbol_table::scope_id scope, - symbol_table::context_id context) + symbol_table::context_id context) const { tree_boolean_expression *new_be = new tree_boolean_expression (op_lhs ? op_lhs->dup (scope, context) : 0, diff -r 57c3155754d6 -r 35cd375d4bb3 src/pt-binop.h --- a/src/pt-binop.h Thu Mar 05 09:37:59 2009 +0100 +++ b/src/pt-binop.h Thu Mar 05 13:50:25 2009 -0500 @@ -82,7 +82,7 @@ tree_expression *rhs (void) { return op_rhs; } tree_expression *dup (symbol_table::scope_id scope, - symbol_table::context_id context); + symbol_table::context_id context) const; void accept (tree_walker& tw); @@ -140,7 +140,7 @@ type op_type (void) const { return etype; } tree_expression *dup (symbol_table::scope_id scope, - symbol_table::context_id context); + symbol_table::context_id context) const; private: diff -r 57c3155754d6 -r 35cd375d4bb3 src/pt-cell.cc --- a/src/pt-cell.cc Thu Mar 05 09:37:59 2009 +0100 +++ b/src/pt-cell.cc Thu Mar 05 13:50:25 2009 -0500 @@ -104,13 +104,13 @@ tree_expression * tree_cell::dup (symbol_table::scope_id scope, - symbol_table::context_id context) + symbol_table::context_id context) const { tree_cell *new_cell = new tree_cell (0, line (), column ()); - for (iterator p = begin (); p != end (); p++) + for (const_iterator p = begin (); p != end (); p++) { - tree_argument_list *elt = *p; + const tree_argument_list *elt = *p; new_cell->append (elt ? elt->dup (scope, context) : 0); } diff -r 57c3155754d6 -r 35cd375d4bb3 src/pt-cell.h --- a/src/pt-cell.h Thu Mar 05 09:37:59 2009 +0100 +++ b/src/pt-cell.h Thu Mar 05 13:50:25 2009 -0500 @@ -54,7 +54,7 @@ octave_value_list rvalue (int); tree_expression *dup (symbol_table::scope_id scope, - symbol_table::context_id context); + symbol_table::context_id context) const; void accept (tree_walker& tw); diff -r 57c3155754d6 -r 35cd375d4bb3 src/pt-cmd.cc --- a/src/pt-cmd.cc Thu Mar 05 09:37:59 2009 +0100 +++ b/src/pt-cmd.cc Thu Mar 05 13:50:25 2009 -0500 @@ -32,7 +32,7 @@ tree_command * tree_no_op_command::dup (symbol_table::scope_id, - symbol_table::context_id /*context*/) + symbol_table::context_id) const { return new tree_no_op_command (orig_cmd, line (), column ()); } @@ -47,7 +47,7 @@ tree_command * tree_function_def::dup (symbol_table::scope_id, - symbol_table::context_id /*context*/) + symbol_table::context_id) const { return new tree_function_def (fcn, line (), column ()); } diff -r 57c3155754d6 -r 35cd375d4bb3 src/pt-cmd.h --- a/src/pt-cmd.h Thu Mar 05 09:37:59 2009 +0100 +++ b/src/pt-cmd.h Thu Mar 05 13:50:25 2009 -0500 @@ -46,7 +46,7 @@ virtual ~tree_command (void) { } virtual tree_command *dup (symbol_table::scope_id, - symbol_table::context_id context) = 0; + symbol_table::context_id context) const = 0; private: @@ -71,7 +71,7 @@ ~tree_no_op_command (void) { } tree_command *dup (symbol_table::scope_id scope, - symbol_table::context_id context); + symbol_table::context_id context) const; void accept (tree_walker& tw); @@ -105,7 +105,7 @@ ~tree_function_def (void) { } tree_command *dup (symbol_table::scope_id scope, - symbol_table::context_id context); + symbol_table::context_id context) const; void accept (tree_walker& tw); diff -r 57c3155754d6 -r 35cd375d4bb3 src/pt-colon.cc --- a/src/pt-colon.cc Thu Mar 05 09:37:59 2009 +0100 +++ b/src/pt-colon.cc Thu Mar 05 13:50:25 2009 -0500 @@ -266,7 +266,7 @@ tree_expression * tree_colon_expression::dup (symbol_table::scope_id scope, - symbol_table::context_id context) + symbol_table::context_id context) const { tree_colon_expression *new_ce = new tree_colon_expression (op_base ? op_base->dup (scope, context) : 0, diff -r 57c3155754d6 -r 35cd375d4bb3 src/pt-colon.h --- a/src/pt-colon.h Thu Mar 05 09:37:59 2009 +0100 +++ b/src/pt-colon.h Thu Mar 05 13:50:25 2009 -0500 @@ -93,7 +93,7 @@ int column (void) const; tree_expression *dup (symbol_table::scope_id scope, - symbol_table::context_id context); + symbol_table::context_id context) const; void accept (tree_walker& tw); diff -r 57c3155754d6 -r 35cd375d4bb3 src/pt-const.cc --- a/src/pt-const.cc Thu Mar 05 09:37:59 2009 +0100 +++ b/src/pt-const.cc Thu Mar 05 13:50:25 2009 -0500 @@ -72,7 +72,7 @@ tree_expression * tree_constant::dup (symbol_table::scope_id, - symbol_table::context_id /*context*/) + symbol_table::context_id) const { tree_constant *new_tc = new tree_constant (val, orig_text, line (), column ()); diff -r 57c3155754d6 -r 35cd375d4bb3 src/pt-const.h --- a/src/pt-const.h Thu Mar 05 09:37:59 2009 +0100 +++ b/src/pt-const.h Thu Mar 05 13:50:25 2009 -0500 @@ -79,7 +79,7 @@ octave_value_list rvalue (int nargout); tree_expression *dup (symbol_table::scope_id scope, - symbol_table::context_id context); + symbol_table::context_id context) const; void accept (tree_walker& tw); diff -r 57c3155754d6 -r 35cd375d4bb3 src/pt-decl.cc --- a/src/pt-decl.cc Thu Mar 05 09:37:59 2009 +0100 +++ b/src/pt-decl.cc Thu Mar 05 13:50:25 2009 -0500 @@ -70,7 +70,7 @@ tree_decl_elt * tree_decl_elt::dup (symbol_table::scope_id scope, - symbol_table::context_id context) + symbol_table::context_id context) const { return new tree_decl_elt (id ? id->dup (scope, context) : 0, expr ? expr->dup (scope, context) : 0); @@ -86,13 +86,13 @@ tree_decl_init_list * tree_decl_init_list::dup (symbol_table::scope_id scope, - symbol_table::context_id context) + symbol_table::context_id context) const { tree_decl_init_list *new_dil = new tree_decl_init_list (); - for (iterator p = begin (); p != end (); p++) + for (const_iterator p = begin (); p != end (); p++) { - tree_decl_elt *elt = *p; + const tree_decl_elt *elt = *p; new_dil->append (elt ? elt->dup (scope, context) : 0); } @@ -117,7 +117,7 @@ tree_command * tree_global_command::dup (symbol_table::scope_id scope, - symbol_table::context_id context) + symbol_table::context_id context) const { return new tree_global_command (init_list ? init_list->dup (scope, context) : 0, @@ -134,7 +134,7 @@ tree_command * tree_static_command::dup (symbol_table::scope_id scope, - symbol_table::context_id context) + symbol_table::context_id context) const { return new tree_static_command (init_list ? init_list->dup (scope, context) : 0, diff -r 57c3155754d6 -r 35cd375d4bb3 src/pt-decl.h --- a/src/pt-decl.h Thu Mar 05 09:37:59 2009 +0100 +++ b/src/pt-decl.h Thu Mar 05 13:50:25 2009 -0500 @@ -88,7 +88,7 @@ tree_expression *expression (void) { return expr; } tree_decl_elt *dup (symbol_table::scope_id scope, - symbol_table::context_id context); + symbol_table::context_id context) const; void accept (tree_walker& tw); @@ -127,7 +127,7 @@ } tree_decl_init_list *dup (symbol_table::scope_id scope, - symbol_table::context_id context); + symbol_table::context_id context) const; void accept (tree_walker& tw); @@ -193,7 +193,7 @@ ~tree_global_command (void) { } tree_command *dup (symbol_table::scope_id scope, - symbol_table::context_id context); + symbol_table::context_id context) const; void accept (tree_walker& tw); @@ -224,7 +224,7 @@ ~tree_static_command (void) { } tree_command *dup (symbol_table::scope_id scope, - symbol_table::context_id context); + symbol_table::context_id context) const; void accept (tree_walker& tw); diff -r 57c3155754d6 -r 35cd375d4bb3 src/pt-except.cc --- a/src/pt-except.cc Thu Mar 05 09:37:59 2009 +0100 +++ b/src/pt-except.cc Thu Mar 05 13:50:25 2009 -0500 @@ -53,7 +53,7 @@ tree_command * tree_try_catch_command::dup (symbol_table::scope_id scope, - symbol_table::context_id context) + symbol_table::context_id context) const { return new tree_try_catch_command (try_code ? try_code->dup (scope, context) : 0, @@ -83,7 +83,7 @@ tree_command * tree_unwind_protect_command::dup (symbol_table::scope_id scope, - symbol_table::context_id context) + symbol_table::context_id context) const { return new tree_unwind_protect_command (unwind_protect_code ? unwind_protect_code->dup (scope, context) : 0, diff -r 57c3155754d6 -r 35cd375d4bb3 src/pt-except.h --- a/src/pt-except.h Thu Mar 05 09:37:59 2009 +0100 +++ b/src/pt-except.h Thu Mar 05 13:50:25 2009 -0500 @@ -64,7 +64,7 @@ octave_comment_list *trailing_comment (void) { return trail_comm; } tree_command *dup (symbol_table::scope_id scope, - symbol_table::context_id context); + symbol_table::context_id context) const; void accept (tree_walker& tw); @@ -125,7 +125,7 @@ octave_comment_list *trailing_comment (void) { return trail_comm; } tree_command *dup (symbol_table::scope_id scope, - symbol_table::context_id context); + symbol_table::context_id context) const; void accept (tree_walker& tw); diff -r 57c3155754d6 -r 35cd375d4bb3 src/pt-exp.h --- a/src/pt-exp.h Thu Mar 05 09:37:59 2009 +0100 +++ b/src/pt-exp.h Thu Mar 05 13:50:25 2009 -0500 @@ -48,7 +48,7 @@ virtual bool has_magic_end (void) const = 0; virtual tree_expression *dup (symbol_table::scope_id, - symbol_table::context_id context) = 0; + symbol_table::context_id context) const = 0; virtual bool is_constant (void) const { return false; } @@ -110,7 +110,7 @@ return this; } - virtual void copy_base (tree_expression& e) + virtual void copy_base (const tree_expression& e) { num_parens = e.num_parens; postfix_indexed = e.postfix_indexed; diff -r 57c3155754d6 -r 35cd375d4bb3 src/pt-fcn-handle.cc --- a/src/pt-fcn-handle.cc Thu Mar 05 09:37:59 2009 +0100 +++ b/src/pt-fcn-handle.cc Thu Mar 05 13:50:25 2009 -0500 @@ -70,7 +70,7 @@ tree_expression * tree_fcn_handle::dup (symbol_table::scope_id, - symbol_table::context_id) + symbol_table::context_id) const { tree_fcn_handle *new_fh = new tree_fcn_handle (nm, line (), column ()); @@ -162,7 +162,7 @@ #if 0 tree_expression * tree_anon_fcn_handle::dup (symbol_table::scope_id parent_scope, - symbol_table::context_id parent_context) + symbol_table::context_id parent_context) const { tree_parameter_list *param_list = parameter_list (); tree_parameter_list *ret_list = return_list (); @@ -187,7 +187,8 @@ #endif tree_expression * -tree_anon_fcn_handle::dup (symbol_table::scope_id, symbol_table::context_id) +tree_anon_fcn_handle::dup (symbol_table::scope_id, + symbol_table::context_id) const { // Instead of simply duplicating, transform to a tree_constant // object that contains an octave_fcn_handle object with the symbol diff -r 57c3155754d6 -r 35cd375d4bb3 src/pt-fcn-handle.h --- a/src/pt-fcn-handle.h Thu Mar 05 09:37:59 2009 +0100 +++ b/src/pt-fcn-handle.h Thu Mar 05 13:50:25 2009 -0500 @@ -70,7 +70,7 @@ octave_value_list rvalue (int nargout); tree_expression *dup (symbol_table::scope_id scope, - symbol_table::context_id context); + symbol_table::context_id context) const; void accept (tree_walker& tw); @@ -110,22 +110,28 @@ octave_value_list rvalue (int nargout); - tree_parameter_list *parameter_list (void) + tree_parameter_list *parameter_list (void) const { return fcn ? fcn->parameter_list () : 0; } - tree_parameter_list *return_list (void) + tree_parameter_list *return_list (void) const { return fcn ? fcn->return_list () : 0; } - tree_statement_list *body (void) { return fcn ? fcn->body () : 0; } + tree_statement_list *body (void) const + { + return fcn ? fcn->body () : 0; + } - symbol_table::scope_id scope (void) { return fcn ? fcn->scope () : -1; } + symbol_table::scope_id scope (void) const + { + return fcn ? fcn->scope () : -1; + } tree_expression *dup (symbol_table::scope_id scope, - symbol_table::context_id context); + symbol_table::context_id context) const; void accept (tree_walker& tw); diff -r 57c3155754d6 -r 35cd375d4bb3 src/pt-id.cc --- a/src/pt-id.cc Thu Mar 05 09:37:59 2009 +0100 +++ b/src/pt-id.cc Thu Mar 05 13:50:25 2009 -0500 @@ -120,14 +120,14 @@ tree_identifier * tree_identifier::dup (symbol_table::scope_id sc, - symbol_table::context_id /*context*/) + symbol_table::context_id) const { // The new tree_identifier object contains a symbol_record // entry from the duplicated scope. // FIXME -- is this the best way? symbol_table::symbol_record new_sym - = symbol_table::find_symbol (xsym().name (), sc); + = symbol_table::find_symbol (name (), sc); tree_identifier *new_id = new tree_identifier (new_sym, line (), column ()); diff -r 57c3155754d6 -r 35cd375d4bb3 src/pt-id.h --- a/src/pt-id.h Thu Mar 05 09:37:59 2009 +0100 +++ b/src/pt-id.h Thu Mar 05 13:50:25 2009 -0500 @@ -110,7 +110,7 @@ void eval_undefined_error (void); tree_identifier *dup (symbol_table::scope_id scope, - symbol_table::context_id context); + symbol_table::context_id context) const; void accept (tree_walker& tw); diff -r 57c3155754d6 -r 35cd375d4bb3 src/pt-idx.cc --- a/src/pt-idx.cc Thu Mar 05 09:37:59 2009 +0100 +++ b/src/pt-idx.cc Thu Mar 05 13:50:25 2009 -0500 @@ -685,7 +685,7 @@ tree_index_expression * tree_index_expression::dup (symbol_table::scope_id scope, - symbol_table::context_id context) + symbol_table::context_id context) const { tree_index_expression *new_idx_expr = new tree_index_expression (line (), column ()); @@ -694,11 +694,11 @@ std::list new_args; - for (std::list::iterator p = args.begin (); + for (std::list::const_iterator p = args.begin (); p != args.end (); p++) { - tree_argument_list *elt = *p; + const tree_argument_list *elt = *p; new_args.push_back (elt ? elt->dup (scope, context) : 0); } @@ -711,11 +711,11 @@ std::list new_dyn_field; - for (std::list::iterator p = dyn_field.begin (); + for (std::list::const_iterator p = dyn_field.begin (); p != dyn_field.end (); p++) { - tree_expression *elt = *p; + const tree_expression *elt = *p; new_dyn_field.push_back (elt ? elt->dup (scope, context) : 0); } diff -r 57c3155754d6 -r 35cd375d4bb3 src/pt-idx.h --- a/src/pt-idx.h Thu Mar 05 09:37:59 2009 +0100 +++ b/src/pt-idx.h Thu Mar 05 13:50:25 2009 -0500 @@ -89,7 +89,7 @@ octave_lvalue lvalue (void); tree_index_expression *dup (symbol_table::scope_id scope, - symbol_table::context_id context); + symbol_table::context_id context) const; void accept (tree_walker& tw); diff -r 57c3155754d6 -r 35cd375d4bb3 src/pt-jump.cc --- a/src/pt-jump.cc Thu Mar 05 09:37:59 2009 +0100 +++ b/src/pt-jump.cc Thu Mar 05 13:50:25 2009 -0500 @@ -40,7 +40,7 @@ tree_command * tree_break_command::dup (symbol_table::scope_id, - symbol_table::context_id /*context*/) + symbol_table::context_id) const { return new tree_break_command (line (), column ()); } @@ -58,7 +58,7 @@ tree_command * tree_continue_command::dup (symbol_table::scope_id, - symbol_table::context_id /*context*/) + symbol_table::context_id) const { return new tree_continue_command (line (), column ()); } @@ -76,7 +76,7 @@ tree_command * tree_return_command::dup (symbol_table::scope_id, - symbol_table::context_id /*context*/) + symbol_table::context_id) const { return new tree_return_command (line (), column ()); } diff -r 57c3155754d6 -r 35cd375d4bb3 src/pt-jump.h --- a/src/pt-jump.h Thu Mar 05 09:37:59 2009 +0100 +++ b/src/pt-jump.h Thu Mar 05 13:50:25 2009 -0500 @@ -41,7 +41,7 @@ ~tree_break_command (void) { } tree_command *dup (symbol_table::scope_id scope, - symbol_table::context_id context); + symbol_table::context_id context) const; void accept (tree_walker& tw); @@ -69,7 +69,7 @@ ~tree_continue_command (void) { } tree_command *dup (symbol_table::scope_id scope, - symbol_table::context_id context); + symbol_table::context_id context) const; void accept (tree_walker& tw); @@ -97,7 +97,7 @@ ~tree_return_command (void) { } tree_command *dup (symbol_table::scope_id scope, - symbol_table::context_id context); + symbol_table::context_id context) const; void accept (tree_walker& tw); diff -r 57c3155754d6 -r 35cd375d4bb3 src/pt-loop.cc --- a/src/pt-loop.cc Thu Mar 05 09:37:59 2009 +0100 +++ b/src/pt-loop.cc Thu Mar 05 13:50:25 2009 -0500 @@ -54,7 +54,7 @@ tree_command * tree_while_command::dup (symbol_table::scope_id scope, - symbol_table::context_id context) + symbol_table::context_id context) const { return new tree_while_command (expr ? expr->dup (scope, context) : 0, list ? list->dup (scope, context) : 0, @@ -73,7 +73,7 @@ tree_command * tree_do_until_command::dup (symbol_table::scope_id scope, - symbol_table::context_id context) + symbol_table::context_id context) const { return new tree_do_until_command (expr ? expr->dup (scope, context) : 0, list ? list->dup (scope, context) : 0, @@ -100,7 +100,7 @@ tree_command * tree_simple_for_command::dup (symbol_table::scope_id scope, - symbol_table::context_id context) + symbol_table::context_id context) const { return new tree_simple_for_command (lhs ? lhs->dup (scope, context) : 0, expr ? expr->dup (scope, context) : 0, @@ -126,7 +126,7 @@ tree_command * tree_complex_for_command::dup (symbol_table::scope_id scope, - symbol_table::context_id context) + symbol_table::context_id context) const { return new tree_complex_for_command (lhs ? lhs->dup (scope, context) : 0, expr ? expr->dup (scope, context) : 0, diff -r 57c3155754d6 -r 35cd375d4bb3 src/pt-loop.h --- a/src/pt-loop.h Thu Mar 05 09:37:59 2009 +0100 +++ b/src/pt-loop.h Thu Mar 05 13:50:25 2009 -0500 @@ -73,7 +73,7 @@ octave_comment_list *trailing_comment (void) { return trail_comm; } tree_command *dup (symbol_table::scope_id scope, - symbol_table::context_id context); + symbol_table::context_id context) const; void accept (tree_walker& tw); @@ -125,7 +125,7 @@ ~tree_do_until_command (void) { } tree_command *dup (symbol_table::scope_id scope, - symbol_table::context_id context); + symbol_table::context_id context) const; void accept (tree_walker& tw); @@ -170,7 +170,7 @@ octave_comment_list *trailing_comment (void) { return trail_comm; } tree_command *dup (symbol_table::scope_id scope, - symbol_table::context_id context); + symbol_table::context_id context) const; void accept (tree_walker& tw); @@ -228,7 +228,7 @@ octave_comment_list *trailing_comment (void) { return trail_comm; } tree_command *dup (symbol_table::scope_id scope, - symbol_table::context_id context); + symbol_table::context_id context) const; void accept (tree_walker& tw); diff -r 57c3155754d6 -r 35cd375d4bb3 src/pt-mat.cc --- a/src/pt-mat.cc Thu Mar 05 09:37:59 2009 +0100 +++ b/src/pt-mat.cc Thu Mar 05 13:50:25 2009 -0500 @@ -1032,13 +1032,13 @@ tree_expression * tree_matrix::dup (symbol_table::scope_id scope, - symbol_table::context_id context) + symbol_table::context_id context) const { tree_matrix *new_matrix = new tree_matrix (0, line (), column ()); - for (iterator p = begin (); p != end (); p++) + for (const_iterator p = begin (); p != end (); p++) { - tree_argument_list *elt = *p; + const tree_argument_list *elt = *p; new_matrix->append (elt ? elt->dup (scope, context) : 0); } diff -r 57c3155754d6 -r 35cd375d4bb3 src/pt-mat.h --- a/src/pt-mat.h Thu Mar 05 09:37:59 2009 +0100 +++ b/src/pt-mat.h Thu Mar 05 13:50:25 2009 -0500 @@ -65,7 +65,7 @@ octave_value_list rvalue (int nargout); tree_expression *dup (symbol_table::scope_id scope, - symbol_table::context_id context); + symbol_table::context_id context) const; void accept (tree_walker& tw); diff -r 57c3155754d6 -r 35cd375d4bb3 src/pt-misc.cc --- a/src/pt-misc.cc Thu Mar 05 09:37:59 2009 +0100 +++ b/src/pt-misc.cc Thu Mar 05 13:50:25 2009 -0500 @@ -248,16 +248,16 @@ tree_parameter_list * tree_parameter_list::dup (symbol_table::scope_id scope, - symbol_table::context_id context) + symbol_table::context_id context) const { tree_parameter_list *new_list = new tree_parameter_list (); if (takes_varargs ()) new_list->mark_varargs (); - for (iterator p = begin (); p != end (); p++) + for (const_iterator p = begin (); p != end (); p++) { - tree_decl_elt *elt = *p; + const tree_decl_elt *elt = *p; new_list->append (elt->dup (scope, context)); } @@ -285,13 +285,13 @@ tree_return_list * tree_return_list::dup (symbol_table::scope_id scope, - symbol_table::context_id context) + symbol_table::context_id context) const { tree_return_list *new_list = new tree_return_list (); - for (iterator p = begin (); p != end (); p++) + for (const_iterator p = begin (); p != end (); p++) { - tree_index_expression *elt = *p; + const tree_index_expression *elt = *p; new_list->append (elt->dup (scope, context)); } diff -r 57c3155754d6 -r 35cd375d4bb3 src/pt-misc.h --- a/src/pt-misc.h Thu Mar 05 09:37:59 2009 +0100 +++ b/src/pt-misc.h Thu Mar 05 13:50:25 2009 -0500 @@ -82,7 +82,7 @@ octave_value_list convert_to_const_vector (const Cell& varargout); tree_parameter_list *dup (symbol_table::scope_id scope, - symbol_table::context_id context); + symbol_table::context_id context) const; void accept (tree_walker& tw); @@ -116,7 +116,7 @@ ~tree_return_list (void); tree_return_list *dup (symbol_table::scope_id scope, - symbol_table::context_id context); + symbol_table::context_id context) const; void accept (tree_walker& tw); diff -r 57c3155754d6 -r 35cd375d4bb3 src/pt-select.cc --- a/src/pt-select.cc Thu Mar 05 09:37:59 2009 +0100 +++ b/src/pt-select.cc Thu Mar 05 13:50:25 2009 -0500 @@ -47,7 +47,7 @@ tree_if_clause * tree_if_clause::dup (symbol_table::scope_id scope, - symbol_table::context_id context) + symbol_table::context_id context) const { return new tree_if_clause (expr ? expr->dup (scope, context) : 0, list ? list->dup (scope, context) : 0, @@ -64,13 +64,13 @@ tree_if_command_list * tree_if_command_list::dup (symbol_table::scope_id scope, - symbol_table::context_id context) + symbol_table::context_id context) const { tree_if_command_list *new_icl = new tree_if_command_list (); - for (iterator p = begin (); p != end (); p++) + for (const_iterator p = begin (); p != end (); p++) { - tree_if_clause *elt = *p; + const tree_if_clause *elt = *p; new_icl->append (elt ? elt->dup (scope, context) : 0); } @@ -119,7 +119,7 @@ tree_command * tree_if_command::dup (symbol_table::scope_id scope, - symbol_table::context_id context) + symbol_table::context_id context) const { return new tree_if_command (list ? list->dup (scope, context) : 0, lead_comm ? lead_comm->dup () : 0, @@ -183,7 +183,7 @@ tree_switch_case * tree_switch_case::dup (symbol_table::scope_id scope, - symbol_table::context_id context) + symbol_table::context_id context) const { return new tree_switch_case (label ? label->dup (scope, context) : 0, list ? list->dup (scope, context) : 0, @@ -200,13 +200,13 @@ tree_switch_case_list * tree_switch_case_list::dup (symbol_table::scope_id scope, - symbol_table::context_id context) + symbol_table::context_id context) const { tree_switch_case_list *new_scl = new tree_switch_case_list (); - for (iterator p = begin (); p != end (); p++) + for (const_iterator p = begin (); p != end (); p++) { - tree_switch_case *elt = *p; + const tree_switch_case *elt = *p; new_scl->append (elt ? elt->dup (scope, context) : 0); } @@ -256,7 +256,7 @@ tree_command * tree_switch_command::dup (symbol_table::scope_id scope, - symbol_table::context_id context) + symbol_table::context_id context) const { return new tree_switch_command (expr ? expr->dup (scope, context) : 0, list ? list->dup (scope, context) : 0, diff -r 57c3155754d6 -r 35cd375d4bb3 src/pt-select.h --- a/src/pt-select.h Thu Mar 05 09:37:59 2009 +0100 +++ b/src/pt-select.h Thu Mar 05 13:50:25 2009 -0500 @@ -64,7 +64,7 @@ octave_comment_list *leading_comment (void) { return lead_comm; } tree_if_clause *dup (symbol_table::scope_id scope, - symbol_table::context_id context); + symbol_table::context_id context) const; void accept (tree_walker& tw); @@ -106,7 +106,7 @@ } tree_if_command_list *dup (symbol_table::scope_id scope, - symbol_table::context_id context); + symbol_table::context_id context) const; void accept (tree_walker& tw); @@ -144,7 +144,7 @@ octave_comment_list *trailing_comment (void) { return trail_comm; } tree_command *dup (symbol_table::scope_id scope, - symbol_table::context_id context); + symbol_table::context_id context) const; void accept (tree_walker& tw); @@ -198,7 +198,7 @@ octave_comment_list *leading_comment (void) { return lead_comm; } tree_switch_case *dup (symbol_table::scope_id scope, - symbol_table::context_id context); + symbol_table::context_id context) const; void accept (tree_walker& tw); @@ -240,7 +240,7 @@ } tree_switch_case_list *dup (symbol_table::scope_id scope, - symbol_table::context_id context); + symbol_table::context_id context) const; void accept (tree_walker& tw); @@ -283,7 +283,7 @@ octave_comment_list *trailing_comment (void) { return trail_comm; } tree_command *dup (symbol_table::scope_id scope, - symbol_table::context_id context); + symbol_table::context_id context) const; void accept (tree_walker& tw); diff -r 57c3155754d6 -r 35cd375d4bb3 src/pt-stmt.cc --- a/src/pt-stmt.cc Thu Mar 05 09:37:59 2009 +0100 +++ b/src/pt-stmt.cc Thu Mar 05 13:50:25 2009 -0500 @@ -133,7 +133,7 @@ tree_statement * tree_statement::dup (symbol_table::scope_id scope, - symbol_table::context_id context) + symbol_table::context_id context) const { tree_statement *new_stmt = new tree_statement (); @@ -194,15 +194,15 @@ tree_statement_list * tree_statement_list::dup (symbol_table::scope_id scope, - symbol_table::context_id context) + symbol_table::context_id context) const { tree_statement_list *new_list = new tree_statement_list (); new_list->function_body = function_body; - for (iterator p = begin (); p != end (); p++) + for (const_iterator p = begin (); p != end (); p++) { - tree_statement *elt = *p; + const tree_statement *elt = *p; new_list->append (elt ? elt->dup (scope, context) : 0); } diff -r 57c3155754d6 -r 35cd375d4bb3 src/pt-stmt.h --- a/src/pt-stmt.h Thu Mar 05 09:37:59 2009 +0100 +++ b/src/pt-stmt.h Thu Mar 05 13:50:25 2009 -0500 @@ -94,7 +94,7 @@ void set_expression (tree_expression *e) { expr = e; } tree_statement *dup (symbol_table::scope_id scope, - symbol_table::context_id context); + symbol_table::context_id context) const; void accept (tree_walker& tw); @@ -161,7 +161,7 @@ octave_value_list list_breakpoints (void); tree_statement_list *dup (symbol_table::scope_id scope, - symbol_table::context_id context); + symbol_table::context_id context) const; void accept (tree_walker& tw); diff -r 57c3155754d6 -r 35cd375d4bb3 src/pt-unop.cc --- a/src/pt-unop.cc Thu Mar 05 09:37:59 2009 +0100 +++ b/src/pt-unop.cc Thu Mar 05 13:50:25 2009 -0500 @@ -102,7 +102,7 @@ tree_expression * tree_prefix_expression::dup (symbol_table::scope_id scope, - symbol_table::context_id context) + symbol_table::context_id context) const { tree_prefix_expression *new_pe = new tree_prefix_expression (op ? op->dup (scope, context) : 0, @@ -180,7 +180,7 @@ tree_expression * tree_postfix_expression::dup (symbol_table::scope_id scope, - symbol_table::context_id context) + symbol_table::context_id context) const { tree_postfix_expression *new_pe = new tree_postfix_expression (op ? op->dup (scope, context) : 0, diff -r 57c3155754d6 -r 35cd375d4bb3 src/pt-unop.h --- a/src/pt-unop.h Thu Mar 05 09:37:59 2009 +0100 +++ b/src/pt-unop.h Thu Mar 05 13:50:25 2009 -0500 @@ -105,7 +105,7 @@ octave_value_list rvalue (int nargout); tree_expression *dup (symbol_table::scope_id scope, - symbol_table::context_id context); + symbol_table::context_id context) const; void accept (tree_walker& tw); @@ -142,7 +142,7 @@ octave_value_list rvalue (int nargout); tree_expression *dup (symbol_table::scope_id scope, - symbol_table::context_id context); + symbol_table::context_id context) const; void accept (tree_walker& tw);