Mercurial > hg > octave-lyh
annotate src/pt-assign.cc @ 8658:73c4516fae10
New evaluator and debugger derived from tree-walker class
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 04 Feb 2009 00:47:53 -0500 |
parents | 188d38a553c7 |
children | 24dd61b36591 |
rev | line source |
---|---|
2980 | 1 /* |
2 | |
7017 | 3 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005, |
4 2006, 2007 John W. Eaton | |
2980 | 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. | |
2980 | 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/>. | |
2980 | 21 |
22 */ | |
23 | |
24 #ifdef HAVE_CONFIG_H | |
25 #include <config.h> | |
26 #endif | |
27 | |
3503 | 28 #include <iostream> |
6253 | 29 #include <set> |
2980 | 30 |
31 #include "defun.h" | |
32 #include "error.h" | |
33 #include "input.h" | |
34 #include "oct-obj.h" | |
35 #include "oct-lvalue.h" | |
36 #include "pager.h" | |
37 #include "ov.h" | |
2982 | 38 #include "pt-arg-list.h" |
3770 | 39 #include "pt-bp.h" |
2980 | 40 #include "pt-assign.h" |
41 #include "pt-walk.h" | |
42 #include "utils.h" | |
5794 | 43 #include "variables.h" |
2980 | 44 |
45 // Simple assignment expressions. | |
46 | |
8037
0be8cf23b95c
check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents:
8011
diff
changeset
|
47 // FIXME -- the following variable and the function that uses it |
0be8cf23b95c
check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents:
8011
diff
changeset
|
48 // should be removed from some future version of Octave. |
0be8cf23b95c
check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents:
8011
diff
changeset
|
49 |
6253 | 50 static const char *former_built_in_variables[] = |
51 { | |
52 "DEFAULT_EXEC_PATH", | |
53 "DEFAULT_LOADPATH", | |
54 "EDITOR", | |
55 "EXEC_PATH", | |
56 "FFTW_WISDOM_PROGRAM", | |
57 "IMAGEPATH", | |
58 "INFO_FILE", | |
59 "INFO_PROGRAM", | |
60 "LOADPATH", | |
61 "MAKEINFO_PROGRAM", | |
62 "PAGER", | |
63 "PS1", | |
64 "PS2", | |
65 "PS4", | |
66 "__kluge_procbuf_delay__", | |
67 "ans", | |
68 "automatic_replot", | |
69 "beep_on_error", | |
70 "completion_append_char", | |
71 "crash_dumps_octave_core", | |
72 "current_script_file_name", | |
73 "debug_on_error", | |
74 "debug_on_interrupt", | |
75 "debug_on_warning", | |
76 "debug_symtab_lookups", | |
77 "default_save_format", | |
78 "echo_executing_commands", | |
79 "fixed_point_format", | |
80 "gnuplot_binary", | |
81 "gnuplot_command_axes", | |
82 "gnuplot_command_end", | |
83 "gnuplot_command_plot", | |
84 "gnuplot_command_replot", | |
85 "gnuplot_command_splot", | |
86 "gnuplot_command_title", | |
87 "gnuplot_command_using", | |
88 "gnuplot_command_with", | |
89 "gnuplot_has_frames", | |
90 "history_file", | |
91 "history_size", | |
92 "ignore_function_time_stamp", | |
93 "max_recursion_depth", | |
94 "octave_core_file_format", | |
95 "octave_core_file_limit", | |
96 "octave_core_file_name", | |
97 "output_max_field_width", | |
98 "output_precision", | |
99 "page_output_immediately", | |
100 "page_screen_output", | |
101 "print_answer_id_name", | |
102 "print_empty_dimensions", | |
103 "print_rhs_assign_val", | |
104 "save_header_format_string", | |
105 "save_precision", | |
106 "saving_history", | |
107 "sighup_dumps_octave_core", | |
108 "sigterm_dumps_octave_core", | |
109 "silent_functions", | |
110 "split_long_rows", | |
111 "string_fill_char", | |
112 "struct_levels_to_print", | |
113 "suppress_verbose_help_message", | |
114 "variables_can_hide_functions", | |
115 "warn_assign_as_truth_value", | |
116 "warn_associativity_change", | |
117 "warn_divide_by_zero", | |
118 "warn_empty_list_elements", | |
119 "warn_fortran_indexing", | |
120 "warn_function_name_clash", | |
121 "warn_future_time_stamp", | |
122 "warn_imag_to_real", | |
123 "warn_matlab_incompatible", | |
124 "warn_missing_semicolon", | |
125 "warn_neg_dim_as_zero", | |
126 "warn_num_to_str", | |
127 "warn_precedence_change", | |
128 "warn_reload_forces_clear", | |
129 "warn_resize_on_range_error", | |
130 "warn_separator_insert", | |
131 "warn_single_quote_string", | |
132 "warn_str_to_num", | |
133 "warn_undefined_return_values", | |
134 "warn_variable_switch_label", | |
135 "whos_line_format", | |
136 0, | |
137 }; | |
138 | |
139 static void | |
140 maybe_warn_former_built_in_variable (const std::string& nm) | |
141 { | |
142 static bool initialized = false; | |
143 | |
144 static std::set<std::string> vars; | |
145 | |
146 if (! initialized) | |
147 { | |
148 const char **p = former_built_in_variables; | |
149 | |
150 while (*p) | |
151 vars.insert (*p++); | |
152 } | |
153 | |
154 if (vars.find (nm) != vars.end ()) | |
155 warning_with_id ("Octave:built-in-variable-assignment", | |
156 "%s is no longer a built-in variable; please read the NEWS file or type `news' for details", | |
157 nm.c_str ()); | |
158 } | |
159 | |
160 tree_simple_assignment::tree_simple_assignment | |
161 (tree_expression *le, tree_expression *re, | |
162 bool plhs, int l, int c, octave_value::assign_op t) | |
8038 | 163 : tree_expression (l, c), lhs (le), rhs (re), preserve (plhs), etype (t), |
8037
0be8cf23b95c
check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents:
8011
diff
changeset
|
164 first_execution (true) { } |
6253 | 165 |
2980 | 166 tree_simple_assignment::~tree_simple_assignment (void) |
167 { | |
168 if (! preserve) | |
169 delete lhs; | |
170 | |
171 delete rhs; | |
172 } | |
173 | |
174 octave_value_list | |
175 tree_simple_assignment::rvalue (int nargout) | |
176 { | |
177 octave_value_list retval; | |
178 | |
179 if (nargout > 1) | |
180 error ("invalid number of output arguments for expression X = RHS"); | |
181 else | |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8580
diff
changeset
|
182 retval = rvalue1 (nargout); |
2980 | 183 |
184 return retval; | |
185 } | |
186 | |
5775 | 187 // FIXME -- this works, but it would look a little better if |
2984 | 188 // it were broken up into a couple of separate functions. |
189 | |
2980 | 190 octave_value |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8580
diff
changeset
|
191 tree_simple_assignment::rvalue1 (int) |
2980 | 192 { |
3208 | 193 octave_value retval; |
2980 | 194 |
8037
0be8cf23b95c
check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents:
8011
diff
changeset
|
195 if (first_execution && lhs) |
0be8cf23b95c
check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents:
8011
diff
changeset
|
196 maybe_warn_former_built_in_variable (lhs->name ()); |
0be8cf23b95c
check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents:
8011
diff
changeset
|
197 |
2980 | 198 if (error_state) |
3208 | 199 return retval; |
2980 | 200 |
201 if (rhs) | |
202 { | |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8580
diff
changeset
|
203 octave_value_list tmp = rhs->rvalue1 (); |
2980 | 204 |
205 if (! (error_state || tmp.empty ())) | |
206 { | |
3208 | 207 octave_value rhs_val = tmp(0); |
2980 | 208 |
209 if (rhs_val.is_undefined ()) | |
210 { | |
211 error ("value on right hand side of assignment is undefined"); | |
7389 | 212 return retval; |
5750 | 213 } |
2980 | 214 else |
215 { | |
7389 | 216 if (rhs_val.is_cs_list ()) |
217 { | |
8580
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8313
diff
changeset
|
218 const octave_value_list lst = rhs_val.list_value (); |
7389 | 219 |
220 if (! lst.empty ()) | |
221 rhs_val = lst(0); | |
222 else | |
223 { | |
224 error ("invalid number of elements on RHS of assignment"); | |
225 return retval; | |
226 } | |
227 } | |
228 | |
2980 | 229 octave_lvalue ult = lhs->lvalue (); |
230 | |
8011
3100283874d7
improve backtrace error messages
John W. Eaton <jwe@octave.org>
parents:
7767
diff
changeset
|
231 if (! error_state) |
2980 | 232 { |
233 ult.assign (etype, rhs_val); | |
234 | |
3215 | 235 if (! error_state) |
236 { | |
3527 | 237 if (etype == octave_value::op_asn_eq) |
3215 | 238 retval = rhs_val; |
239 else | |
240 retval = ult.value (); | |
2984 | 241 |
3215 | 242 if (print_result ()) |
3208 | 243 { |
5841 | 244 // We clear any index here so that we can |
245 // get the new value of the referenced | |
246 // object below, instead of the indexed | |
247 // value (which should be the same as the | |
248 // right hand side value). | |
2980 | 249 |
5841 | 250 ult.clear_index (); |
3208 | 251 |
5841 | 252 octave_value lhs_val = ult.value (); |
3208 | 253 |
5841 | 254 if (! error_state) |
255 lhs_val.print_with_name (octave_stdout, | |
256 lhs->name ()); | |
2980 | 257 } |
258 } | |
259 } | |
260 } | |
261 } | |
262 } | |
263 | |
8037
0be8cf23b95c
check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents:
8011
diff
changeset
|
264 first_execution = false; |
0be8cf23b95c
check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents:
8011
diff
changeset
|
265 |
3208 | 266 return retval; |
2980 | 267 } |
268 | |
3536 | 269 std::string |
2980 | 270 tree_simple_assignment::oper (void) const |
271 { | |
272 return octave_value::assign_op_as_string (etype); | |
273 } | |
274 | |
5861 | 275 tree_expression * |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7389
diff
changeset
|
276 tree_simple_assignment::dup (symbol_table::scope_id scope, |
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7389
diff
changeset
|
277 symbol_table::context_id context) |
5861 | 278 { |
279 tree_simple_assignment *new_sa | |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7389
diff
changeset
|
280 = new tree_simple_assignment (lhs ? lhs->dup (scope, context) : 0, |
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7389
diff
changeset
|
281 rhs ? rhs->dup (scope, context) : 0, |
5861 | 282 preserve, etype); |
283 | |
284 new_sa->copy_base (*this); | |
285 | |
286 return new_sa; | |
287 } | |
288 | |
2980 | 289 void |
290 tree_simple_assignment::accept (tree_walker& tw) | |
291 { | |
292 tw.visit_simple_assignment (*this); | |
293 } | |
294 | |
295 // Multi-valued assignment expressions. | |
296 | |
6253 | 297 tree_multi_assignment::tree_multi_assignment |
298 (tree_argument_list *lst, tree_expression *r, | |
299 bool plhs, int l, int c, octave_value::assign_op t) | |
8038 | 300 : tree_expression (l, c), lhs (lst), rhs (r), preserve (plhs), etype (t), |
8037
0be8cf23b95c
check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents:
8011
diff
changeset
|
301 first_execution (true) { } |
6253 | 302 |
2980 | 303 tree_multi_assignment::~tree_multi_assignment (void) |
304 { | |
305 if (! preserve) | |
306 delete lhs; | |
307 | |
308 delete rhs; | |
309 } | |
310 | |
311 octave_value | |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8580
diff
changeset
|
312 tree_multi_assignment::rvalue1 (int nargout) |
2980 | 313 { |
314 octave_value retval; | |
315 | |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8580
diff
changeset
|
316 const octave_value_list tmp = rvalue (nargout); |
2980 | 317 |
318 if (! tmp.empty ()) | |
319 retval = tmp(0); | |
320 | |
321 return retval; | |
322 } | |
323 | |
5775 | 324 // FIXME -- this works, but it would look a little better if |
2984 | 325 // it were broken up into a couple of separate functions. |
326 | |
2980 | 327 octave_value_list |
328 tree_multi_assignment::rvalue (int) | |
329 { | |
3208 | 330 octave_value_list retval; |
2980 | 331 |
332 if (error_state) | |
3208 | 333 return retval; |
2980 | 334 |
8037
0be8cf23b95c
check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents:
8011
diff
changeset
|
335 if (first_execution) |
0be8cf23b95c
check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents:
8011
diff
changeset
|
336 { |
0be8cf23b95c
check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents:
8011
diff
changeset
|
337 for (tree_argument_list::iterator p = lhs->begin (); p != lhs->end (); p++) |
0be8cf23b95c
check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents:
8011
diff
changeset
|
338 { |
0be8cf23b95c
check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents:
8011
diff
changeset
|
339 tree_expression *lhs_expr = *p; |
0be8cf23b95c
check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents:
8011
diff
changeset
|
340 |
0be8cf23b95c
check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents:
8011
diff
changeset
|
341 if (lhs_expr) |
0be8cf23b95c
check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents:
8011
diff
changeset
|
342 maybe_warn_former_built_in_variable (lhs_expr->name ()); |
0be8cf23b95c
check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents:
8011
diff
changeset
|
343 } |
0be8cf23b95c
check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents:
8011
diff
changeset
|
344 } |
0be8cf23b95c
check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents:
8011
diff
changeset
|
345 |
2980 | 346 if (rhs) |
347 { | |
5846 | 348 std::list<octave_lvalue> lvalue_list = lhs->lvalue_list (); |
3977 | 349 |
350 if (error_state) | |
351 return retval; | |
2980 | 352 |
5846 | 353 int n_out = 0; |
354 | |
355 for (std::list<octave_lvalue>::const_iterator p = lvalue_list.begin (); | |
356 p != lvalue_list.end (); | |
357 p++) | |
358 n_out += p->numel (); | |
359 | |
8580
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8313
diff
changeset
|
360 // The following trick is used to keep rhs_val constant. |
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8313
diff
changeset
|
361 const octave_value_list rhs_val1 = rhs->rvalue (n_out); |
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8313
diff
changeset
|
362 const octave_value_list rhs_val = (rhs_val1.length () == 1 && rhs_val1(0).is_cs_list () |
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8313
diff
changeset
|
363 ? rhs_val1(0).list_value () : rhs_val1); |
2980 | 364 |
3977 | 365 if (error_state) |
366 return retval; | |
2980 | 367 |
3977 | 368 if (rhs_val.empty ()) |
369 { | |
5846 | 370 if (n_out > 0) |
371 { | |
372 error ("value on right hand side of assignment is undefined"); | |
373 return retval; | |
374 } | |
3977 | 375 } |
376 else | |
377 { | |
5846 | 378 octave_idx_type k = 0; |
2980 | 379 |
5846 | 380 octave_idx_type n = rhs_val.length (); |
2980 | 381 |
8580
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8313
diff
changeset
|
382 // To avoid copying per elements and possible optimizations, we |
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8313
diff
changeset
|
383 // postpone joining the final values. |
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8313
diff
changeset
|
384 std::list<octave_value_list> retval_list; |
3208 | 385 |
5846 | 386 tree_argument_list::iterator q = lhs->begin (); |
387 | |
388 for (std::list<octave_lvalue>::iterator p = lvalue_list.begin (); | |
389 p != lvalue_list.end (); | |
4219 | 390 p++) |
3977 | 391 { |
5846 | 392 tree_expression *lhs_elt = *q++; |
393 | |
394 octave_lvalue ult = *p; | |
395 | |
396 octave_idx_type nel = ult.numel (); | |
3977 | 397 |
5846 | 398 if (nel > 1) |
3977 | 399 { |
5846 | 400 if (k + nel <= n) |
401 { | |
402 if (etype == octave_value::op_asn_eq) | |
403 { | |
8580
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8313
diff
changeset
|
404 // This won't do a copy. |
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8313
diff
changeset
|
405 octave_value_list ovl = rhs_val.slice (k, nel); |
5846 | 406 |
407 ult.assign (etype, octave_value (ovl, true)); | |
2980 | 408 |
5846 | 409 if (! error_state) |
410 { | |
8580
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8313
diff
changeset
|
411 retval_list.push_back (ovl); |
5846 | 412 |
413 k += nel; | |
414 } | |
415 } | |
416 else | |
417 { | |
418 std::string op = octave_value::assign_op_as_string (etype); | |
419 error ("operator %s unsupported for comma-separated list assignment", | |
420 op.c_str ()); | |
421 } | |
5750 | 422 } |
5846 | 423 else |
424 error ("some elements undefined in return list"); | |
425 } | |
8313
86bc7785bf8b
handle correctly empty cs-lists in assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8038
diff
changeset
|
426 else if (nel == 1) |
5846 | 427 { |
428 if (k < n) | |
3977 | 429 { |
430 ult.assign (etype, rhs_val(k)); | |
431 | |
432 if (! error_state) | |
3208 | 433 { |
3977 | 434 if (etype == octave_value::op_asn_eq) |
8580
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8313
diff
changeset
|
435 retval_list.push_back (rhs_val(k)); |
3208 | 436 else |
8580
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8313
diff
changeset
|
437 retval_list.push_back (ult.value ()); |
5846 | 438 |
439 k++; | |
2980 | 440 } |
441 } | |
3208 | 442 else |
3977 | 443 error ("element number %d undefined in return list", k+1); |
5846 | 444 } |
2980 | 445 |
5846 | 446 if (error_state) |
8011
3100283874d7
improve backtrace error messages
John W. Eaton <jwe@octave.org>
parents:
7767
diff
changeset
|
447 break; |
5846 | 448 else if (print_result ()) |
449 { | |
450 // We clear any index here so that we can get | |
451 // the new value of the referenced object below, | |
452 // instead of the indexed value (which should be | |
453 // the same as the right hand side value). | |
3977 | 454 |
5846 | 455 ult.clear_index (); |
3208 | 456 |
5846 | 457 octave_value lhs_val = ult.value (); |
3977 | 458 |
5846 | 459 if (! error_state) |
460 lhs_val.print_with_name (octave_stdout, | |
461 lhs_elt->name ()); | |
2980 | 462 } |
3977 | 463 |
464 if (error_state) | |
465 break; | |
466 | |
2980 | 467 } |
8580
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8313
diff
changeset
|
468 |
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8313
diff
changeset
|
469 // Concatenate return values. |
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8313
diff
changeset
|
470 retval = retval_list; |
2980 | 471 } |
472 } | |
473 | |
8037
0be8cf23b95c
check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents:
8011
diff
changeset
|
474 first_execution = false; |
0be8cf23b95c
check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents:
8011
diff
changeset
|
475 |
3208 | 476 return retval; |
2980 | 477 } |
478 | |
3536 | 479 std::string |
3208 | 480 tree_multi_assignment::oper (void) const |
481 { | |
482 return octave_value::assign_op_as_string (etype); | |
483 } | |
484 | |
5861 | 485 tree_expression * |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7389
diff
changeset
|
486 tree_multi_assignment::dup (symbol_table::scope_id scope, |
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7389
diff
changeset
|
487 symbol_table::context_id context) |
5861 | 488 { |
489 tree_multi_assignment *new_ma | |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7389
diff
changeset
|
490 = new tree_multi_assignment (lhs ? lhs->dup (scope, context) : 0, |
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7389
diff
changeset
|
491 rhs ? rhs->dup (scope, context) : 0, |
5861 | 492 preserve, etype); |
493 | |
494 new_ma->copy_base (*this); | |
495 | |
496 return new_ma; | |
497 } | |
498 | |
2980 | 499 void |
500 tree_multi_assignment::accept (tree_walker& tw) | |
501 { | |
502 tw.visit_multi_assignment (*this); | |
503 } | |
504 | |
505 /* | |
506 ;;; Local Variables: *** | |
507 ;;; mode: C++ *** | |
508 ;;; End: *** | |
509 */ |