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