comparison src/pt-decl.cc @ 8913:35cd375d4bb3

make tree::dup functions const
author John W. Eaton <jwe@octave.org>
date Thu, 05 Mar 2009 13:50:25 -0500
parents 73c4516fae10
children eb63fbe60fab
comparison
equal deleted inserted replaced
8912:57c3155754d6 8913:35cd375d4bb3
68 return retval; 68 return retval;
69 } 69 }
70 70
71 tree_decl_elt * 71 tree_decl_elt *
72 tree_decl_elt::dup (symbol_table::scope_id scope, 72 tree_decl_elt::dup (symbol_table::scope_id scope,
73 symbol_table::context_id context) 73 symbol_table::context_id context) const
74 { 74 {
75 return new tree_decl_elt (id ? id->dup (scope, context) : 0, 75 return new tree_decl_elt (id ? id->dup (scope, context) : 0,
76 expr ? expr->dup (scope, context) : 0); 76 expr ? expr->dup (scope, context) : 0);
77 } 77 }
78 78
84 84
85 // Initializer lists for declaration statements. 85 // Initializer lists for declaration statements.
86 86
87 tree_decl_init_list * 87 tree_decl_init_list *
88 tree_decl_init_list::dup (symbol_table::scope_id scope, 88 tree_decl_init_list::dup (symbol_table::scope_id scope,
89 symbol_table::context_id context) 89 symbol_table::context_id context) const
90 { 90 {
91 tree_decl_init_list *new_dil = new tree_decl_init_list (); 91 tree_decl_init_list *new_dil = new tree_decl_init_list ();
92 92
93 for (iterator p = begin (); p != end (); p++) 93 for (const_iterator p = begin (); p != end (); p++)
94 { 94 {
95 tree_decl_elt *elt = *p; 95 const tree_decl_elt *elt = *p;
96 96
97 new_dil->append (elt ? elt->dup (scope, context) : 0); 97 new_dil->append (elt ? elt->dup (scope, context) : 0);
98 } 98 }
99 99
100 return new_dil; 100 return new_dil;
115 115
116 // Global. 116 // Global.
117 117
118 tree_command * 118 tree_command *
119 tree_global_command::dup (symbol_table::scope_id scope, 119 tree_global_command::dup (symbol_table::scope_id scope,
120 symbol_table::context_id context) 120 symbol_table::context_id context) const
121 { 121 {
122 return 122 return
123 new tree_global_command (init_list ? init_list->dup (scope, context) : 0, 123 new tree_global_command (init_list ? init_list->dup (scope, context) : 0,
124 line (), column ()); 124 line (), column ());
125 } 125 }
132 132
133 // Static. 133 // Static.
134 134
135 tree_command * 135 tree_command *
136 tree_static_command::dup (symbol_table::scope_id scope, 136 tree_static_command::dup (symbol_table::scope_id scope,
137 symbol_table::context_id context) 137 symbol_table::context_id context) const
138 { 138 {
139 return 139 return
140 new tree_static_command (init_list ? init_list->dup (scope, context) : 0, 140 new tree_static_command (init_list ? init_list->dup (scope, context) : 0,
141 line (), column ()); 141 line (), column ());
142 } 142 }