Mercurial > octave-nkf
annotate src/pt-loop.cc @ 7767:71f068b22fcc
scope and context fixes for function handles
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 07 May 2008 13:45:30 -0400 |
parents | 360b4f7684fd |
children | 3100283874d7 |
rev | line source |
---|---|
2982 | 1 /* |
2 | |
7017 | 3 Copyright (C) 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005, |
4 2006, 2007 John W. Eaton | |
2982 | 5 |
6 This file is part of Octave. | |
7 | |
8 Octave is free software; you can redistribute it and/or modify it | |
9 under the terms of the GNU General Public License as published by the | |
7016 | 10 Free Software Foundation; either version 3 of the License, or (at your |
11 option) any later version. | |
2982 | 12 |
13 Octave is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
2982 | 21 |
22 */ | |
23 | |
24 #ifdef HAVE_CONFIG_H | |
25 #include <config.h> | |
26 #endif | |
27 | |
4153 | 28 #include "quit.h" |
29 | |
2982 | 30 #include "error.h" |
31 #include "gripes.h" | |
32 #include "oct-map.h" | |
33 #include "oct-lvalue.h" | |
34 #include "ov.h" | |
35 #include "pt-arg-list.h" | |
3770 | 36 #include "pt-bp.h" |
2982 | 37 #include "pt-cmd.h" |
38 #include "pt-exp.h" | |
2985 | 39 #include "pt-jump.h" |
2982 | 40 #include "pt-loop.h" |
41 #include "pt-stmt.h" | |
42 #include "pt-walk.h" | |
3877 | 43 #include "unwind-prot.h" |
44 | |
45 // TRUE means we are evaluating some kind of looping construct. | |
46 bool evaluating_looping_command = false; | |
2982 | 47 |
48 // Decide if it's time to quit a for or while loop. | |
49 static inline bool | |
50 quit_loop_now (void) | |
51 { | |
4153 | 52 OCTAVE_QUIT; |
53 | |
2982 | 54 // Maybe handle `continue N' someday... |
55 | |
4207 | 56 if (tree_continue_command::continuing) |
57 tree_continue_command::continuing--; | |
2982 | 58 |
2985 | 59 bool quit = (error_state |
4207 | 60 || tree_return_command::returning |
61 || tree_break_command::breaking | |
62 || tree_continue_command::continuing); | |
2982 | 63 |
4207 | 64 if (tree_break_command::breaking) |
65 tree_break_command::breaking--; | |
2982 | 66 |
67 return quit; | |
68 } | |
69 | |
70 // While. | |
71 | |
72 tree_while_command::~tree_while_command (void) | |
73 { | |
74 delete expr; | |
75 delete list; | |
3665 | 76 delete lead_comm; |
77 delete trail_comm; | |
2982 | 78 } |
79 | |
80 void | |
81 tree_while_command::eval (void) | |
82 { | |
83 if (error_state) | |
84 return; | |
85 | |
3877 | 86 unwind_protect::begin_frame ("while_command::eval"); |
87 | |
88 unwind_protect_bool (evaluating_looping_command); | |
89 | |
90 evaluating_looping_command = true; | |
91 | |
2982 | 92 if (! expr) |
93 panic_impossible (); | |
94 | |
95 for (;;) | |
96 { | |
97 if (expr->is_logically_true ("while")) | |
98 { | |
99 if (list) | |
100 { | |
101 list->eval (); | |
102 | |
103 if (error_state) | |
104 { | |
105 eval_error (); | |
3877 | 106 goto cleanup; |
2982 | 107 } |
108 } | |
109 | |
110 if (quit_loop_now ()) | |
111 break; | |
112 } | |
113 else | |
114 break; | |
115 } | |
3877 | 116 |
117 cleanup: | |
118 unwind_protect::run_frame ("while_command::eval"); | |
2982 | 119 } |
120 | |
121 void | |
122 tree_while_command::eval_error (void) | |
123 { | |
3965 | 124 ::error ("evaluating while command near line %d, column %d", |
125 line (), column ()); | |
2982 | 126 } |
127 | |
5861 | 128 tree_command * |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7469
diff
changeset
|
129 tree_while_command::dup (symbol_table::scope_id scope, |
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7469
diff
changeset
|
130 symbol_table::context_id context) |
5861 | 131 { |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7469
diff
changeset
|
132 return new tree_while_command (expr ? expr->dup (scope, context) : 0, |
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7469
diff
changeset
|
133 list ? list->dup (scope, context) : 0, |
5861 | 134 lead_comm ? lead_comm->dup () : 0, |
135 trail_comm ? trail_comm->dup (): 0, | |
136 line (), column ()); | |
137 } | |
138 | |
2982 | 139 void |
140 tree_while_command::accept (tree_walker& tw) | |
141 { | |
142 tw.visit_while_command (*this); | |
143 } | |
144 | |
3484 | 145 // Do-Until |
146 | |
147 void | |
148 tree_do_until_command::eval (void) | |
149 { | |
150 if (error_state) | |
151 return; | |
152 | |
3877 | 153 unwind_protect::begin_frame ("do_until_command::eval"); |
154 | |
155 unwind_protect_bool (evaluating_looping_command); | |
156 | |
157 evaluating_looping_command = true; | |
158 | |
3484 | 159 if (! expr) |
160 panic_impossible (); | |
161 | |
162 for (;;) | |
163 { | |
3770 | 164 MAYBE_DO_BREAKPOINT; |
165 | |
3484 | 166 if (list) |
167 { | |
168 list->eval (); | |
169 | |
170 if (error_state) | |
171 { | |
172 eval_error (); | |
3877 | 173 goto cleanup; |
3484 | 174 } |
175 } | |
176 | |
177 if (quit_loop_now () || expr->is_logically_true ("do-until")) | |
178 break; | |
179 } | |
3877 | 180 |
181 cleanup: | |
182 unwind_protect::run_frame ("do_until_command::eval"); | |
3484 | 183 } |
184 | |
185 void | |
186 tree_do_until_command::eval_error (void) | |
187 { | |
3965 | 188 ::error ("evaluating do-until command near line %d, column %d", |
189 line (), column ()); | |
3484 | 190 } |
191 | |
5861 | 192 tree_command * |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7469
diff
changeset
|
193 tree_do_until_command::dup (symbol_table::scope_id scope, |
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7469
diff
changeset
|
194 symbol_table::context_id context) |
5861 | 195 { |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7469
diff
changeset
|
196 return new tree_do_until_command (expr ? expr->dup (scope, context) : 0, |
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7469
diff
changeset
|
197 list ? list->dup (scope, context) : 0, |
5861 | 198 lead_comm ? lead_comm->dup () : 0, |
199 trail_comm ? trail_comm->dup (): 0, | |
200 line (), column ()); | |
201 } | |
202 | |
3484 | 203 void |
204 tree_do_until_command::accept (tree_walker& tw) | |
205 { | |
206 tw.visit_do_until_command (*this); | |
207 } | |
208 | |
2982 | 209 // For. |
210 | |
211 tree_simple_for_command::~tree_simple_for_command (void) | |
212 { | |
213 delete expr; | |
214 delete list; | |
3665 | 215 delete lead_comm; |
216 delete trail_comm; | |
2982 | 217 } |
218 | |
219 inline void | |
220 tree_simple_for_command::do_for_loop_once (octave_lvalue& ult, | |
221 const octave_value& rhs, | |
222 bool& quit) | |
223 { | |
3538 | 224 ult.assign (octave_value::op_asn_eq, rhs); |
2982 | 225 |
226 if (! error_state) | |
227 { | |
228 if (list) | |
229 { | |
230 list->eval (); | |
231 | |
232 if (error_state) | |
233 eval_error (); | |
234 } | |
235 } | |
236 else | |
237 eval_error (); | |
238 | |
239 quit = quit_loop_now (); | |
240 } | |
241 | |
6602 | 242 #define DO_ND_LOOP(MTYPE, TYPE, CONV, ARG) \ |
2982 | 243 do \ |
244 { \ | |
6602 | 245 dim_vector dv = ARG.dims (); \ |
2982 | 246 \ |
6602 | 247 bool quit = false; \ |
248 \ | |
249 TYPE *atmp = ARG.fortran_vec (); \ | |
250 \ | |
5570 | 251 octave_idx_type steps = dv(1); \ |
4911 | 252 \ |
6602 | 253 octave_idx_type nrows = dv(0); \ |
254 \ | |
255 int ndims = dv.length (); \ | |
256 if (ndims > 2) \ | |
257 { \ | |
258 for (int i = 2; i < ndims; i++) \ | |
259 steps *= dv(i); \ | |
260 dv(1) = steps; \ | |
261 dv.resize (2); \ | |
262 } \ | |
4911 | 263 \ |
6602 | 264 if (steps > 0) \ |
265 { \ | |
266 if (nrows == 0) \ | |
267 { \ | |
6665 | 268 MTYPE tarray (dim_vector (0, 1)); \ |
269 \ | |
270 octave_value val (tarray); \ | |
6602 | 271 \ |
272 for (octave_idx_type i = 0; i < steps; i++) \ | |
273 { \ | |
274 MAYBE_DO_BREAKPOINT; \ | |
5570 | 275 \ |
6602 | 276 do_for_loop_once (ult, val, quit); \ |
5570 | 277 \ |
6602 | 278 if (quit) \ |
279 break; \ | |
280 } \ | |
281 } \ | |
282 else if (nrows == 1) \ | |
283 { \ | |
284 for (octave_idx_type i = 0; i < steps; i++) \ | |
285 { \ | |
286 MAYBE_DO_BREAKPOINT; \ | |
5570 | 287 \ |
6602 | 288 octave_value val (CONV (*atmp++)); \ |
289 \ | |
290 do_for_loop_once (ult, val, quit); \ | |
5570 | 291 \ |
6602 | 292 if (quit) \ |
293 break; \ | |
294 } \ | |
295 } \ | |
296 else \ | |
297 { \ | |
298 if (ndims > 2) \ | |
299 ARG = ARG.reshape (dv); \ | |
4911 | 300 \ |
6602 | 301 MTYPE tmp (dim_vector (nrows, 1)); \ |
302 \ | |
303 TYPE *ftmp = tmp.fortran_vec (); \ | |
4911 | 304 \ |
6602 | 305 for (octave_idx_type i = 0; i < steps; i++) \ |
306 { \ | |
307 MAYBE_DO_BREAKPOINT; \ | |
308 \ | |
309 for (int j = 0; j < nrows; j++) \ | |
310 ftmp[j] = *atmp++; \ | |
311 \ | |
312 octave_value val (tmp); \ | |
4911 | 313 \ |
6602 | 314 do_for_loop_once (ult, val, quit); \ |
315 quit = (i == steps - 1 ? true : quit); \ | |
4911 | 316 \ |
6602 | 317 if (quit) \ |
318 break; \ | |
319 } \ | |
320 } \ | |
321 } \ | |
4911 | 322 } \ |
323 while (0) | |
324 | |
2982 | 325 void |
326 tree_simple_for_command::eval (void) | |
327 { | |
328 if (error_state) | |
329 return; | |
330 | |
3877 | 331 unwind_protect::begin_frame ("simple_for_command::eval"); |
332 | |
333 unwind_protect_bool (evaluating_looping_command); | |
334 | |
335 evaluating_looping_command = true; | |
336 | |
2982 | 337 octave_value rhs = expr->rvalue (); |
338 | |
339 if (error_state || rhs.is_undefined ()) | |
340 { | |
341 eval_error (); | |
3877 | 342 goto cleanup; |
2982 | 343 } |
344 | |
3877 | 345 { |
346 octave_lvalue ult = lhs->lvalue (); | |
3180 | 347 |
3877 | 348 if (error_state) |
349 { | |
350 eval_error (); | |
351 goto cleanup; | |
352 } | |
353 | |
354 if (rhs.is_range ()) | |
355 { | |
356 Range rng = rhs.range_value (); | |
3180 | 357 |
5275 | 358 octave_idx_type steps = rng.nelem (); |
3877 | 359 double b = rng.base (); |
360 double increment = rng.inc (); | |
6602 | 361 bool quit = false; |
3770 | 362 |
7469
360b4f7684fd
fix for loop iteration limit bug with ranges
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
363 for (octave_idx_type i = 0; i < steps; i++) |
3877 | 364 { |
365 MAYBE_DO_BREAKPOINT; | |
3180 | 366 |
7469
360b4f7684fd
fix for loop iteration limit bug with ranges
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
367 // Use multiplication here rather than declaring a |
360b4f7684fd
fix for loop iteration limit bug with ranges
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
368 // temporary variable outside the loop and using |
360b4f7684fd
fix for loop iteration limit bug with ranges
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
369 // |
360b4f7684fd
fix for loop iteration limit bug with ranges
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
370 // tmp_val += increment |
360b4f7684fd
fix for loop iteration limit bug with ranges
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
371 // |
360b4f7684fd
fix for loop iteration limit bug with ranges
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
372 // to avoid problems with limited precision. Also, this |
360b4f7684fd
fix for loop iteration limit bug with ranges
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
373 // is consistent with the way Range::matrix_value is |
360b4f7684fd
fix for loop iteration limit bug with ranges
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
374 // implemented. |
360b4f7684fd
fix for loop iteration limit bug with ranges
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
375 |
360b4f7684fd
fix for loop iteration limit bug with ranges
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
376 octave_value val (b + i * increment); |
3180 | 377 |
3877 | 378 do_for_loop_once (ult, val, quit); |
3180 | 379 |
3877 | 380 if (quit) |
381 break; | |
382 } | |
383 } | |
384 else if (rhs.is_scalar_type ()) | |
385 { | |
386 bool quit = false; | |
387 | |
388 MAYBE_DO_BREAKPOINT; | |
2982 | 389 |
3877 | 390 do_for_loop_once (ult, rhs, quit); |
391 } | |
392 else if (rhs.is_string ()) | |
393 { | |
394 charMatrix chm_tmp = rhs.char_matrix_value (); | |
5275 | 395 octave_idx_type nr = chm_tmp.rows (); |
396 octave_idx_type steps = chm_tmp.columns (); | |
6602 | 397 bool quit = false; |
3215 | 398 |
3877 | 399 if (error_state) |
400 goto cleanup; | |
3215 | 401 |
3877 | 402 if (nr == 1) |
6602 | 403 { |
404 for (octave_idx_type i = 0; i < steps; i++) | |
405 { | |
406 MAYBE_DO_BREAKPOINT; | |
407 | |
408 octave_value val (chm_tmp.xelem (0, i)); | |
409 | |
410 do_for_loop_once (ult, val, quit); | |
411 | |
412 if (quit) | |
413 break; | |
414 } | |
415 } | |
3877 | 416 else |
417 { | |
5275 | 418 for (octave_idx_type i = 0; i < steps; i++) |
3877 | 419 { |
420 MAYBE_DO_BREAKPOINT; | |
3770 | 421 |
3877 | 422 octave_value val (chm_tmp.extract (0, i, nr-1, i), true); |
3215 | 423 |
3877 | 424 do_for_loop_once (ult, val, quit); |
3215 | 425 |
3877 | 426 if (quit) |
427 break; | |
428 } | |
429 } | |
430 } | |
431 else if (rhs.is_matrix_type ()) | |
432 { | |
3998 | 433 if (rhs.is_real_type ()) |
3877 | 434 { |
6602 | 435 NDArray m_tmp = rhs.array_value (); |
436 | |
437 if (error_state) | |
438 goto cleanup; | |
439 | |
440 DO_ND_LOOP (NDArray, double, , m_tmp); | |
3877 | 441 } |
442 else | |
443 { | |
6602 | 444 ComplexNDArray cm_tmp = rhs.complex_array_value (); |
5570 | 445 |
6602 | 446 if (error_state) |
447 goto cleanup; | |
5570 | 448 |
6602 | 449 DO_ND_LOOP (ComplexNDArray, Complex, , cm_tmp); |
5246 | 450 } |
3877 | 451 } |
452 else if (rhs.is_map ()) | |
453 { | |
454 Octave_map tmp_val (rhs.map_value ()); | |
2982 | 455 |
6602 | 456 bool quit = false; |
457 | |
4219 | 458 for (Octave_map::iterator p = tmp_val.begin (); |
459 p != tmp_val.end (); | |
460 p++) | |
3877 | 461 { |
462 MAYBE_DO_BREAKPOINT; | |
3770 | 463 |
4513 | 464 Cell val_lst = tmp_val.contents (p); |
4121 | 465 |
466 octave_value val | |
467 = (val_lst.length () == 1) ? val_lst(0) : octave_value (val_lst); | |
2982 | 468 |
3877 | 469 do_for_loop_once (ult, val, quit); |
2982 | 470 |
3877 | 471 if (quit) |
472 break; | |
473 } | |
474 } | |
4911 | 475 else if (rhs.is_cell ()) |
476 { | |
477 Cell c_tmp = rhs.cell_value (); | |
5248 | 478 |
6602 | 479 DO_ND_LOOP (Cell, octave_value, Cell, c_tmp); |
4911 | 480 } |
3877 | 481 else |
482 { | |
483 ::error ("invalid type in for loop expression near line %d, column %d", | |
484 line (), column ()); | |
485 } | |
486 } | |
487 | |
488 cleanup: | |
489 unwind_protect::run_frame ("simple_for_command::eval"); | |
2982 | 490 } |
491 | |
492 void | |
493 tree_simple_for_command::eval_error (void) | |
494 { | |
3965 | 495 ::error ("evaluating for command near line %d, column %d", |
496 line (), column ()); | |
2982 | 497 } |
498 | |
5861 | 499 tree_command * |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7469
diff
changeset
|
500 tree_simple_for_command::dup (symbol_table::scope_id scope, |
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7469
diff
changeset
|
501 symbol_table::context_id context) |
5861 | 502 { |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7469
diff
changeset
|
503 return new tree_simple_for_command (lhs ? lhs->dup (scope, context) : 0, |
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7469
diff
changeset
|
504 expr ? expr->dup (scope, context) : 0, |
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7469
diff
changeset
|
505 list ? list->dup (scope, context) : 0, |
5861 | 506 lead_comm ? lead_comm->dup () : 0, |
507 trail_comm ? trail_comm->dup () : 0, | |
508 line (), column ()); | |
509 } | |
510 | |
2982 | 511 void |
512 tree_simple_for_command::accept (tree_walker& tw) | |
513 { | |
514 tw.visit_simple_for_command (*this); | |
515 } | |
516 | |
517 tree_complex_for_command::~tree_complex_for_command (void) | |
518 { | |
519 delete expr; | |
520 delete list; | |
3665 | 521 delete lead_comm; |
522 delete trail_comm; | |
2982 | 523 } |
524 | |
525 void | |
526 tree_complex_for_command::do_for_loop_once (octave_lvalue &val_ref, | |
527 octave_lvalue &key_ref, | |
528 const octave_value& val, | |
529 const octave_value& key, | |
530 bool& quit) | |
531 { | |
532 quit = false; | |
533 | |
3538 | 534 val_ref.assign (octave_value::op_asn_eq, val); |
535 key_ref.assign (octave_value::op_asn_eq, key); | |
2982 | 536 |
537 if (! error_state) | |
538 { | |
539 if (list) | |
540 { | |
541 list->eval (); | |
542 | |
543 if (error_state) | |
544 eval_error (); | |
545 } | |
546 } | |
547 else | |
548 eval_error (); | |
549 | |
550 quit = quit_loop_now (); | |
551 } | |
552 | |
553 void | |
554 tree_complex_for_command::eval (void) | |
555 { | |
556 if (error_state) | |
557 return; | |
558 | |
3877 | 559 unwind_protect::begin_frame ("complex_for_command::eval"); |
560 | |
561 unwind_protect_bool (evaluating_looping_command); | |
562 | |
563 evaluating_looping_command = true; | |
564 | |
2982 | 565 octave_value rhs = expr->rvalue (); |
566 | |
567 if (error_state || rhs.is_undefined ()) | |
568 { | |
569 eval_error (); | |
3877 | 570 goto cleanup; |
2982 | 571 } |
572 | |
573 if (rhs.is_map ()) | |
574 { | |
575 // Cycle through structure elements. First element of id_list | |
576 // is set to value and the second is set to the name of the | |
577 // structure element. | |
578 | |
4219 | 579 tree_argument_list::iterator p = lhs->begin (); |
580 tree_expression *elt = *p++; | |
2982 | 581 octave_lvalue val_ref = elt->lvalue (); |
4219 | 582 elt = *p; |
2982 | 583 octave_lvalue key_ref = elt->lvalue (); |
584 | |
585 Octave_map tmp_val (rhs.map_value ()); | |
586 | |
4300 | 587 for (Octave_map::iterator q = tmp_val.begin (); q != tmp_val.end (); q++) |
2982 | 588 { |
4219 | 589 octave_value key = tmp_val.key (q); |
4121 | 590 |
4513 | 591 Cell val_lst = tmp_val.contents (q); |
4121 | 592 |
5275 | 593 octave_idx_type n = tmp_val.numel (); |
4121 | 594 |
595 octave_value val = (n == 1) ? val_lst(0) : octave_value (val_lst); | |
2982 | 596 |
3770 | 597 MAYBE_DO_BREAKPOINT; |
598 | |
2982 | 599 bool quit = false; |
600 | |
601 do_for_loop_once (key_ref, val_ref, key, val, quit); | |
602 | |
603 if (quit) | |
604 break; | |
605 } | |
606 } | |
607 else | |
608 error ("in statement `for [X, Y] = VAL', VAL must be a structure"); | |
3877 | 609 |
610 cleanup: | |
611 unwind_protect::run_frame ("complex_for_command::eval"); | |
2982 | 612 } |
613 | |
614 void | |
615 tree_complex_for_command::eval_error (void) | |
616 { | |
3965 | 617 ::error ("evaluating for command near line %d, column %d", |
618 line (), column ()); | |
2982 | 619 } |
620 | |
5861 | 621 tree_command * |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7469
diff
changeset
|
622 tree_complex_for_command::dup (symbol_table::scope_id scope, |
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7469
diff
changeset
|
623 symbol_table::context_id context) |
5861 | 624 { |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7469
diff
changeset
|
625 return new tree_complex_for_command (lhs ? lhs->dup (scope, context) : 0, |
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7469
diff
changeset
|
626 expr ? expr->dup (scope, context) : 0, |
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7469
diff
changeset
|
627 list ? list->dup (scope, context) : 0, |
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7469
diff
changeset
|
628 lead_comm ? lead_comm->dup () : 0, |
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7469
diff
changeset
|
629 trail_comm ? trail_comm->dup () : 0, |
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7469
diff
changeset
|
630 line (), column ()); |
5861 | 631 } |
632 | |
2982 | 633 void |
634 tree_complex_for_command::accept (tree_walker& tw) | |
635 { | |
636 tw.visit_complex_for_command (*this); | |
637 } | |
638 | |
639 /* | |
640 ;;; Local Variables: *** | |
641 ;;; mode: C++ *** | |
642 ;;; End: *** | |
643 */ |