comparison src/pt-decl.cc @ 7336:745a8299c2b5

[project @ 2007-12-28 20:56:55 by jwe]
author jwe
date Fri, 28 Dec 2007 20:56:58 +0000
parents f3d508351e49
children 71f068b22fcc
comparison
equal deleted inserted replaced
7335:58f5fab3ebe5 7336:745a8299c2b5
67 67
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 *sym_tab) 72 tree_decl_elt::dup (symbol_table::scope_id scope)
73 { 73 {
74 return new tree_decl_elt (id ? id->dup (sym_tab) : 0, 74 return new tree_decl_elt (id ? id->dup (scope) : 0,
75 expr ? expr->dup (sym_tab) : 0); 75 expr ? expr->dup (scope) : 0);
76 } 76 }
77 77
78 void 78 void
79 tree_decl_elt::accept (tree_walker& tw) 79 tree_decl_elt::accept (tree_walker& tw)
80 { 80 {
96 break; 96 break;
97 } 97 }
98 } 98 }
99 99
100 tree_decl_init_list * 100 tree_decl_init_list *
101 tree_decl_init_list::dup (symbol_table *sym_tab) 101 tree_decl_init_list::dup (symbol_table::scope_id scope)
102 { 102 {
103 tree_decl_init_list *new_dil = new tree_decl_init_list (); 103 tree_decl_init_list *new_dil = new tree_decl_init_list ();
104 104
105 for (iterator p = begin (); p != end (); p++) 105 for (iterator p = begin (); p != end (); p++)
106 { 106 {
107 tree_decl_elt *elt = *p; 107 tree_decl_elt *elt = *p;
108 108
109 new_dil->append (elt ? elt->dup (sym_tab) : 0); 109 new_dil->append (elt ? elt->dup (scope) : 0);
110 } 110 }
111 111
112 return new_dil; 112 return new_dil;
113 } 113 }
114 114
138 { 138 {
139 tree_identifier *id = elt.ident (); 139 tree_identifier *id = elt.ident ();
140 140
141 if (id) 141 if (id)
142 { 142 {
143 id->link_to_global (); 143 id->mark_global ();
144 144
145 if (! error_state) 145 if (! error_state)
146 { 146 {
147 octave_lvalue ult = id->lvalue (); 147 octave_lvalue ult = id->lvalue ();
148 148
167 tree_global_command::eval (void) 167 tree_global_command::eval (void)
168 { 168 {
169 MAYBE_DO_BREAKPOINT; 169 MAYBE_DO_BREAKPOINT;
170 170
171 if (init_list) 171 if (init_list)
172 { 172 init_list->eval (do_init);
173 init_list->eval (do_init);
174
175 initialized = true;
176 }
177 173
178 if (error_state) 174 if (error_state)
179 ::error ("evaluating global command near line %d, column %d", 175 ::error ("evaluating global command near line %d, column %d",
180 line (), column ()); 176 line (), column ());
181 } 177 }
182 178
183 tree_command * 179 tree_command *
184 tree_global_command::dup (symbol_table *sym_tab) 180 tree_global_command::dup (symbol_table::scope_id scope)
185 { 181 {
186 return new tree_global_command (init_list ? init_list->dup (sym_tab) : 0, 182 return new tree_global_command (init_list ? init_list->dup (scope) : 0,
187 line (), column ()); 183 line (), column ());
188 } 184 }
189 185
190 // Static. 186 // Static.
191 187
221 { 217 {
222 MAYBE_DO_BREAKPOINT; 218 MAYBE_DO_BREAKPOINT;
223 219
224 // Static variables only need to be marked and initialized once. 220 // Static variables only need to be marked and initialized once.
225 221
226 if (init_list && ! initialized) 222 if (init_list)
227 { 223 init_list->eval (do_init);
228 init_list->eval (do_init); 224
229 225 if (error_state)
230 initialized = true; 226 ::error ("evaluating static command near line %d, column %d",
231 227 line (), column ());
232 if (error_state)
233 ::error ("evaluating static command near line %d, column %d",
234 line (), column ());
235 }
236 } 228 }
237 229
238 tree_command * 230 tree_command *
239 tree_static_command::dup (symbol_table *sym_tab) 231 tree_static_command::dup (symbol_table::scope_id scope)
240 { 232 {
241 return new tree_static_command (init_list ? init_list->dup (sym_tab) : 0, 233 return new tree_static_command (init_list ? init_list->dup (scope) : 0,
242 line (), column ()); 234 line (), column ());
243 } 235 }
244 236
245 /* 237 /*
246 ;;; Local Variables: *** 238 ;;; Local Variables: ***