Mercurial > hg > octave-lyh
annotate src/pt-assign.cc @ 8905:24dd61b36591
assign rvalue1 result to octave_value object, not octave_value_list object
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 03 Mar 2009 14:02:20 -0500 |
parents | 73c4516fae10 |
children | 35cd375d4bb3 |
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 | |
187 octave_value | |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8580
diff
changeset
|
188 tree_simple_assignment::rvalue1 (int) |
2980 | 189 { |
3208 | 190 octave_value retval; |
2980 | 191 |
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
|
192 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
|
193 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
|
194 |
2980 | 195 if (error_state) |
3208 | 196 return retval; |
2980 | 197 |
198 if (rhs) | |
199 { | |
8905
24dd61b36591
assign rvalue1 result to octave_value object, not octave_value_list object
John W. Eaton <jwe@octave.org>
parents:
8658
diff
changeset
|
200 octave_value rhs_val = rhs->rvalue1 (); |
2980 | 201 |
8905
24dd61b36591
assign rvalue1 result to octave_value object, not octave_value_list object
John W. Eaton <jwe@octave.org>
parents:
8658
diff
changeset
|
202 if (! error_state) |
2980 | 203 { |
204 if (rhs_val.is_undefined ()) | |
205 { | |
206 error ("value on right hand side of assignment is undefined"); | |
7389 | 207 return retval; |
5750 | 208 } |
2980 | 209 else |
210 { | |
7389 | 211 if (rhs_val.is_cs_list ()) |
212 { | |
8580
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8313
diff
changeset
|
213 const octave_value_list lst = rhs_val.list_value (); |
7389 | 214 |
215 if (! lst.empty ()) | |
216 rhs_val = lst(0); | |
217 else | |
218 { | |
219 error ("invalid number of elements on RHS of assignment"); | |
220 return retval; | |
221 } | |
222 } | |
223 | |
2980 | 224 octave_lvalue ult = lhs->lvalue (); |
225 | |
8011
3100283874d7
improve backtrace error messages
John W. Eaton <jwe@octave.org>
parents:
7767
diff
changeset
|
226 if (! error_state) |
2980 | 227 { |
228 ult.assign (etype, rhs_val); | |
229 | |
3215 | 230 if (! error_state) |
231 { | |
3527 | 232 if (etype == octave_value::op_asn_eq) |
3215 | 233 retval = rhs_val; |
234 else | |
235 retval = ult.value (); | |
2984 | 236 |
3215 | 237 if (print_result ()) |
3208 | 238 { |
5841 | 239 // We clear any index here so that we can |
240 // get the new value of the referenced | |
241 // object below, instead of the indexed | |
242 // value (which should be the same as the | |
243 // right hand side value). | |
2980 | 244 |
5841 | 245 ult.clear_index (); |
3208 | 246 |
5841 | 247 octave_value lhs_val = ult.value (); |
3208 | 248 |
5841 | 249 if (! error_state) |
250 lhs_val.print_with_name (octave_stdout, | |
251 lhs->name ()); | |
2980 | 252 } |
253 } | |
254 } | |
255 } | |
256 } | |
257 } | |
258 | |
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
|
259 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
|
260 |
3208 | 261 return retval; |
2980 | 262 } |
263 | |
3536 | 264 std::string |
2980 | 265 tree_simple_assignment::oper (void) const |
266 { | |
267 return octave_value::assign_op_as_string (etype); | |
268 } | |
269 | |
5861 | 270 tree_expression * |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7389
diff
changeset
|
271 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
|
272 symbol_table::context_id context) |
5861 | 273 { |
274 tree_simple_assignment *new_sa | |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7389
diff
changeset
|
275 = 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
|
276 rhs ? rhs->dup (scope, context) : 0, |
5861 | 277 preserve, etype); |
278 | |
279 new_sa->copy_base (*this); | |
280 | |
281 return new_sa; | |
282 } | |
283 | |
2980 | 284 void |
285 tree_simple_assignment::accept (tree_walker& tw) | |
286 { | |
287 tw.visit_simple_assignment (*this); | |
288 } | |
289 | |
290 // Multi-valued assignment expressions. | |
291 | |
6253 | 292 tree_multi_assignment::tree_multi_assignment |
293 (tree_argument_list *lst, tree_expression *r, | |
294 bool plhs, int l, int c, octave_value::assign_op t) | |
8038 | 295 : 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
|
296 first_execution (true) { } |
6253 | 297 |
2980 | 298 tree_multi_assignment::~tree_multi_assignment (void) |
299 { | |
300 if (! preserve) | |
301 delete lhs; | |
302 | |
303 delete rhs; | |
304 } | |
305 | |
306 octave_value | |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8580
diff
changeset
|
307 tree_multi_assignment::rvalue1 (int nargout) |
2980 | 308 { |
309 octave_value retval; | |
310 | |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8580
diff
changeset
|
311 const octave_value_list tmp = rvalue (nargout); |
2980 | 312 |
313 if (! tmp.empty ()) | |
314 retval = tmp(0); | |
315 | |
316 return retval; | |
317 } | |
318 | |
5775 | 319 // FIXME -- this works, but it would look a little better if |
2984 | 320 // it were broken up into a couple of separate functions. |
321 | |
2980 | 322 octave_value_list |
323 tree_multi_assignment::rvalue (int) | |
324 { | |
3208 | 325 octave_value_list retval; |
2980 | 326 |
327 if (error_state) | |
3208 | 328 return retval; |
2980 | 329 |
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
|
330 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
|
331 { |
0be8cf23b95c
check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents:
8011
diff
changeset
|
332 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
|
333 { |
0be8cf23b95c
check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents:
8011
diff
changeset
|
334 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
|
335 |
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 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
|
337 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
|
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 } |
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 |
2980 | 341 if (rhs) |
342 { | |
5846 | 343 std::list<octave_lvalue> lvalue_list = lhs->lvalue_list (); |
3977 | 344 |
345 if (error_state) | |
346 return retval; | |
2980 | 347 |
5846 | 348 int n_out = 0; |
349 | |
350 for (std::list<octave_lvalue>::const_iterator p = lvalue_list.begin (); | |
351 p != lvalue_list.end (); | |
352 p++) | |
353 n_out += p->numel (); | |
354 | |
8580
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8313
diff
changeset
|
355 // The following trick is used to keep rhs_val constant. |
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8313
diff
changeset
|
356 const octave_value_list rhs_val1 = rhs->rvalue (n_out); |
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8313
diff
changeset
|
357 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
|
358 ? rhs_val1(0).list_value () : rhs_val1); |
2980 | 359 |
3977 | 360 if (error_state) |
361 return retval; | |
2980 | 362 |
3977 | 363 if (rhs_val.empty ()) |
364 { | |
5846 | 365 if (n_out > 0) |
366 { | |
367 error ("value on right hand side of assignment is undefined"); | |
368 return retval; | |
369 } | |
3977 | 370 } |
371 else | |
372 { | |
5846 | 373 octave_idx_type k = 0; |
2980 | 374 |
5846 | 375 octave_idx_type n = rhs_val.length (); |
2980 | 376 |
8580
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8313
diff
changeset
|
377 // To avoid copying per elements and possible optimizations, we |
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8313
diff
changeset
|
378 // postpone joining the final values. |
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8313
diff
changeset
|
379 std::list<octave_value_list> retval_list; |
3208 | 380 |
5846 | 381 tree_argument_list::iterator q = lhs->begin (); |
382 | |
383 for (std::list<octave_lvalue>::iterator p = lvalue_list.begin (); | |
384 p != lvalue_list.end (); | |
4219 | 385 p++) |
3977 | 386 { |
5846 | 387 tree_expression *lhs_elt = *q++; |
388 | |
389 octave_lvalue ult = *p; | |
390 | |
391 octave_idx_type nel = ult.numel (); | |
3977 | 392 |
5846 | 393 if (nel > 1) |
3977 | 394 { |
5846 | 395 if (k + nel <= n) |
396 { | |
397 if (etype == octave_value::op_asn_eq) | |
398 { | |
8580
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8313
diff
changeset
|
399 // This won't do a copy. |
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8313
diff
changeset
|
400 octave_value_list ovl = rhs_val.slice (k, nel); |
5846 | 401 |
402 ult.assign (etype, octave_value (ovl, true)); | |
2980 | 403 |
5846 | 404 if (! error_state) |
405 { | |
8580
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8313
diff
changeset
|
406 retval_list.push_back (ovl); |
5846 | 407 |
408 k += nel; | |
409 } | |
410 } | |
411 else | |
412 { | |
413 std::string op = octave_value::assign_op_as_string (etype); | |
414 error ("operator %s unsupported for comma-separated list assignment", | |
415 op.c_str ()); | |
416 } | |
5750 | 417 } |
5846 | 418 else |
419 error ("some elements undefined in return list"); | |
420 } | |
8313
86bc7785bf8b
handle correctly empty cs-lists in assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8038
diff
changeset
|
421 else if (nel == 1) |
5846 | 422 { |
423 if (k < n) | |
3977 | 424 { |
425 ult.assign (etype, rhs_val(k)); | |
426 | |
427 if (! error_state) | |
3208 | 428 { |
3977 | 429 if (etype == octave_value::op_asn_eq) |
8580
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8313
diff
changeset
|
430 retval_list.push_back (rhs_val(k)); |
3208 | 431 else |
8580
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8313
diff
changeset
|
432 retval_list.push_back (ult.value ()); |
5846 | 433 |
434 k++; | |
2980 | 435 } |
436 } | |
3208 | 437 else |
3977 | 438 error ("element number %d undefined in return list", k+1); |
5846 | 439 } |
2980 | 440 |
5846 | 441 if (error_state) |
8011
3100283874d7
improve backtrace error messages
John W. Eaton <jwe@octave.org>
parents:
7767
diff
changeset
|
442 break; |
5846 | 443 else if (print_result ()) |
444 { | |
445 // We clear any index here so that we can get | |
446 // the new value of the referenced object below, | |
447 // instead of the indexed value (which should be | |
448 // the same as the right hand side value). | |
3977 | 449 |
5846 | 450 ult.clear_index (); |
3208 | 451 |
5846 | 452 octave_value lhs_val = ult.value (); |
3977 | 453 |
5846 | 454 if (! error_state) |
455 lhs_val.print_with_name (octave_stdout, | |
456 lhs_elt->name ()); | |
2980 | 457 } |
3977 | 458 |
459 if (error_state) | |
460 break; | |
461 | |
2980 | 462 } |
8580
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8313
diff
changeset
|
463 |
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8313
diff
changeset
|
464 // Concatenate return values. |
188d38a553c7
further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents:
8313
diff
changeset
|
465 retval = retval_list; |
2980 | 466 } |
467 } | |
468 | |
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
|
469 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
|
470 |
3208 | 471 return retval; |
2980 | 472 } |
473 | |
3536 | 474 std::string |
3208 | 475 tree_multi_assignment::oper (void) const |
476 { | |
477 return octave_value::assign_op_as_string (etype); | |
478 } | |
479 | |
5861 | 480 tree_expression * |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7389
diff
changeset
|
481 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
|
482 symbol_table::context_id context) |
5861 | 483 { |
484 tree_multi_assignment *new_ma | |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7389
diff
changeset
|
485 = 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
|
486 rhs ? rhs->dup (scope, context) : 0, |
5861 | 487 preserve, etype); |
488 | |
489 new_ma->copy_base (*this); | |
490 | |
491 return new_ma; | |
492 } | |
493 | |
2980 | 494 void |
495 tree_multi_assignment::accept (tree_walker& tw) | |
496 { | |
497 tw.visit_multi_assignment (*this); | |
498 } | |
499 | |
500 /* | |
501 ;;; Local Variables: *** | |
502 ;;; mode: C++ *** | |
503 ;;; End: *** | |
504 */ |