annotate src/pt-assign.cc @ 10843:229675bb7647 ss-3-3-52

version is now 3.3.52
author John W. Eaton <jwe@octave.org>
date Sun, 01 Aug 2010 11:49:45 -0400
parents 1b2fcd122c6a
children fd0a3ac60b0e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
1 /*
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
2
7017
a1dbe9d80eee [project @ 2007-10-12 21:27:11 by jwe]
jwe
parents: 7016
diff changeset
3 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005,
8920
eb63fbe60fab update copyright notices
John W. Eaton <jwe@octave.org>
parents: 8913
diff changeset
4 2006, 2007, 2008, 2009 John W. Eaton
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
5
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
6 This file is part of Octave.
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
7
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
8 Octave is free software; you can redistribute it and/or modify it
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
9 under the terms of the GNU General Public License as published by the
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6483
diff changeset
10 Free Software Foundation; either version 3 of the License, or (at your
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6483
diff changeset
11 option) any later version.
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
12
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
13 Octave is distributed in the hope that it will be useful, but WITHOUT
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
16 for more details.
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
17
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6483
diff changeset
19 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6483
diff changeset
20 <http://www.gnu.org/licenses/>.
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
21
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
22 */
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
23
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
24 #ifdef HAVE_CONFIG_H
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
25 #include <config.h>
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
26 #endif
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
27
3503
d14c483b3c12 [project @ 2000-02-01 04:06:07 by jwe]
jwe
parents: 3448
diff changeset
28 #include <iostream>
6253
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
29 #include <set>
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
30
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
31 #include "defun.h"
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
32 #include "error.h"
10030
83bb2a78c07d improve simple assignments error checks and messages
Jaroslav Hajek <highegg@gmail.com>
parents: 9782
diff changeset
33 #include "gripes.h"
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
34 #include "input.h"
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
35 #include "oct-obj.h"
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
36 #include "oct-lvalue.h"
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
37 #include "pager.h"
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
38 #include "ov.h"
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents: 2980
diff changeset
39 #include "pt-arg-list.h"
3770
bf6116ca10eb [project @ 2001-02-02 02:21:40 by jwe]
jwe
parents: 3536
diff changeset
40 #include "pt-bp.h"
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
41 #include "pt-assign.h"
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
42 #include "pt-walk.h"
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
43 #include "utils.h"
5794
1138ced03f14 [project @ 2006-05-08 20:23:04 by jwe]
jwe
parents: 5775
diff changeset
44 #include "variables.h"
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
45
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
46 // Simple assignment expressions.
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
47
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
48 // 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
49 // 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
50
6253
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
51 static const char *former_built_in_variables[] =
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
52 {
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
53 "DEFAULT_EXEC_PATH",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
54 "DEFAULT_LOADPATH",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
55 "EDITOR",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
56 "EXEC_PATH",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
57 "FFTW_WISDOM_PROGRAM",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
58 "IMAGEPATH",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
59 "INFO_FILE",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
60 "INFO_PROGRAM",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
61 "LOADPATH",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
62 "MAKEINFO_PROGRAM",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
63 "PAGER",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
64 "PS1",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
65 "PS2",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
66 "PS4",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
67 "__kluge_procbuf_delay__",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
68 "automatic_replot",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
69 "beep_on_error",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
70 "completion_append_char",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
71 "crash_dumps_octave_core",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
72 "current_script_file_name",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
73 "debug_on_error",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
74 "debug_on_interrupt",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
75 "debug_on_warning",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
76 "debug_symtab_lookups",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
77 "default_save_format",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
78 "echo_executing_commands",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
79 "fixed_point_format",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
80 "gnuplot_binary",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
81 "gnuplot_command_axes",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
82 "gnuplot_command_end",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
83 "gnuplot_command_plot",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
84 "gnuplot_command_replot",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
85 "gnuplot_command_splot",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
86 "gnuplot_command_title",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
87 "gnuplot_command_using",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
88 "gnuplot_command_with",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
89 "gnuplot_has_frames",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
90 "history_file",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
91 "history_size",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
92 "ignore_function_time_stamp",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
93 "max_recursion_depth",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
94 "octave_core_file_format",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
95 "octave_core_file_limit",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
96 "octave_core_file_name",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
97 "output_max_field_width",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
98 "output_precision",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
99 "page_output_immediately",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
100 "page_screen_output",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
101 "print_answer_id_name",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
102 "print_empty_dimensions",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
103 "print_rhs_assign_val",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
104 "save_header_format_string",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
105 "save_precision",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
106 "saving_history",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
107 "sighup_dumps_octave_core",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
108 "sigterm_dumps_octave_core",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
109 "silent_functions",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
110 "split_long_rows",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
111 "string_fill_char",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
112 "struct_levels_to_print",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
113 "suppress_verbose_help_message",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
114 "variables_can_hide_functions",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
115 "warn_assign_as_truth_value",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
116 "warn_associativity_change",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
117 "warn_divide_by_zero",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
118 "warn_empty_list_elements",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
119 "warn_fortran_indexing",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
120 "warn_function_name_clash",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
121 "warn_future_time_stamp",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
122 "warn_imag_to_real",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
123 "warn_matlab_incompatible",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
124 "warn_missing_semicolon",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
125 "warn_neg_dim_as_zero",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
126 "warn_num_to_str",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
127 "warn_precedence_change",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
128 "warn_reload_forces_clear",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
129 "warn_resize_on_range_error",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
130 "warn_separator_insert",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
131 "warn_single_quote_string",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
132 "warn_str_to_num",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
133 "warn_undefined_return_values",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
134 "warn_variable_switch_label",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
135 "whos_line_format",
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
136 0,
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
137 };
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
138
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
139 static void
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
140 maybe_warn_former_built_in_variable (const std::string& nm)
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
141 {
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
142 static bool initialized = false;
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
143
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
144 static std::set<std::string> vars;
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
145
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
146 if (! initialized)
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
147 {
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
148 const char **p = former_built_in_variables;
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
149
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
150 while (*p)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
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
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
154 }
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
155
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
156 if (vars.find (nm) != vars.end ())
9421
86eb5ff921d0 pt-assign.cc (maybe_warn_former_built_in_variable): improve message
John W. Eaton <jwe@octave.org>
parents: 9387
diff changeset
157 {
86eb5ff921d0 pt-assign.cc (maybe_warn_former_built_in_variable): improve message
John W. Eaton <jwe@octave.org>
parents: 9387
diff changeset
158 const char *nm_c_str = nm.c_str ();
86eb5ff921d0 pt-assign.cc (maybe_warn_former_built_in_variable): improve message
John W. Eaton <jwe@octave.org>
parents: 9387
diff changeset
159
86eb5ff921d0 pt-assign.cc (maybe_warn_former_built_in_variable): improve message
John W. Eaton <jwe@octave.org>
parents: 9387
diff changeset
160 warning_with_id ("Octave:built-in-variable-assignment",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
161 "%s is now a function instead of a built-in variable. By assigning to %s, you have created a variable that hides the function %s. To remove the variable and restore the function, type \"clear %s\"",
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
162 nm_c_str, nm_c_str, nm_c_str, nm_c_str);
9421
86eb5ff921d0 pt-assign.cc (maybe_warn_former_built_in_variable): improve message
John W. Eaton <jwe@octave.org>
parents: 9387
diff changeset
163 }
6253
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
164 }
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
165
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
166 tree_simple_assignment::tree_simple_assignment
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
167 (tree_expression *le, tree_expression *re,
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
168 bool plhs, int l, int c, octave_value::assign_op t)
8038
aa6484781a5b fix typo in last commit
John W. Eaton <jwe@octave.org>
parents: 8037
diff changeset
169 : 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
170 first_execution (true) { }
6253
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
171
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
172 tree_simple_assignment::~tree_simple_assignment (void)
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
173 {
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
174 if (! preserve)
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
175 delete lhs;
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
176
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
177 delete rhs;
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
178 }
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
179
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
180 octave_value_list
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
181 tree_simple_assignment::rvalue (int nargout)
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
182 {
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
183 octave_value_list retval;
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
184
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
185 if (nargout > 1)
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
186 error ("invalid number of output arguments for expression X = RHS");
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
187 else
8658
73c4516fae10 New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents: 8580
diff changeset
188 retval = rvalue1 (nargout);
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
189
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
190 return retval;
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
191 }
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
192
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
193 octave_value
8658
73c4516fae10 New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents: 8580
diff changeset
194 tree_simple_assignment::rvalue1 (int)
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
195 {
3208
e8a7163701be [project @ 1998-11-03 05:12:47 by jwe]
jwe
parents: 2991
diff changeset
196 octave_value retval;
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
197
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
198 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
199 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
200
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
201 if (error_state)
3208
e8a7163701be [project @ 1998-11-03 05:12:47 by jwe]
jwe
parents: 2991
diff changeset
202 return retval;
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
203
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
204 if (rhs)
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
205 {
8905
24dd61b36591 assign rvalue1 result to octave_value object, not octave_value_list object
John W. Eaton <jwe@octave.org>
parents: 8658
diff changeset
206 octave_value rhs_val = rhs->rvalue1 ();
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
207
8905
24dd61b36591 assign rvalue1 result to octave_value object, not octave_value_list object
John W. Eaton <jwe@octave.org>
parents: 8658
diff changeset
208 if (! error_state)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
209 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
210 if (rhs_val.is_undefined ())
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
211 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
212 error ("value on right hand side of assignment is undefined");
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
213 return retval;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
214 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
215 else
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
216 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
217 if (rhs_val.is_cs_list ())
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
218 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
219 const octave_value_list lst = rhs_val.list_value ();
7389
4d0d6c357bc6 [project @ 2008-01-16 08:32:13 by jwe]
jwe
parents: 7336
diff changeset
220
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
221 if (! lst.empty ())
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
222 rhs_val = lst(0);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
223 else
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
224 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
225 error ("invalid number of elements on RHS of assignment");
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
226 return retval;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
227 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
228 }
7389
4d0d6c357bc6 [project @ 2008-01-16 08:32:13 by jwe]
jwe
parents: 7336
diff changeset
229
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
230 octave_lvalue ult = lhs->lvalue ();
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
231
10030
83bb2a78c07d improve simple assignments error checks and messages
Jaroslav Hajek <highegg@gmail.com>
parents: 9782
diff changeset
232 if (ult.numel () != 1)
83bb2a78c07d improve simple assignments error checks and messages
Jaroslav Hajek <highegg@gmail.com>
parents: 9782
diff changeset
233 gripe_nonbraced_cs_list_assignment ();
83bb2a78c07d improve simple assignments error checks and messages
Jaroslav Hajek <highegg@gmail.com>
parents: 9782
diff changeset
234
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
235 if (! error_state)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
236 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
237 ult.assign (etype, rhs_val);
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
238
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
239 if (! error_state)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
240 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
241 if (etype == octave_value::op_asn_eq)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
242 retval = rhs_val;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
243 else
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
244 retval = ult.value ();
2984
84c33881d0bc [project @ 1997-05-16 05:14:33 by jwe]
jwe
parents: 2982
diff changeset
245
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
246 if (print_result ())
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
247 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
248 // We clear any index here so that we can
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
249 // get the new value of the referenced
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
250 // object below, instead of the indexed
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
251 // value (which should be the same as the
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
252 // right hand side value).
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
253
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
254 ult.clear_index ();
3208
e8a7163701be [project @ 1998-11-03 05:12:47 by jwe]
jwe
parents: 2991
diff changeset
255
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
256 octave_value lhs_val = ult.value ();
3208
e8a7163701be [project @ 1998-11-03 05:12:47 by jwe]
jwe
parents: 2991
diff changeset
257
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
258 if (! error_state)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
259 lhs_val.print_with_name (octave_stdout,
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
260 lhs->name ());
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
261 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
262 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
263 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
264 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
265 }
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
266 }
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
267
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
268 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
269
3208
e8a7163701be [project @ 1998-11-03 05:12:47 by jwe]
jwe
parents: 2991
diff changeset
270 return retval;
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
271 }
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
272
3536
e8fbc8c3d6d9 [project @ 2000-02-02 12:01:00 by jwe]
jwe
parents: 3534
diff changeset
273 std::string
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
274 tree_simple_assignment::oper (void) const
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
275 {
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
276 return octave_value::assign_op_as_string (etype);
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
277 }
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
278
5861
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5846
diff changeset
279 tree_expression *
7767
71f068b22fcc scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents: 7389
diff changeset
280 tree_simple_assignment::dup (symbol_table::scope_id scope,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
281 symbol_table::context_id context) const
5861
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5846
diff changeset
282 {
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5846
diff changeset
283 tree_simple_assignment *new_sa
7767
71f068b22fcc scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents: 7389
diff changeset
284 = new tree_simple_assignment (lhs ? lhs->dup (scope, context) : 0,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
285 rhs ? rhs->dup (scope, context) : 0,
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
286 preserve, etype);
5861
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5846
diff changeset
287
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5846
diff changeset
288 new_sa->copy_base (*this);
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5846
diff changeset
289
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5846
diff changeset
290 return new_sa;
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5846
diff changeset
291 }
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5846
diff changeset
292
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
293 void
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
294 tree_simple_assignment::accept (tree_walker& tw)
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
295 {
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
296 tw.visit_simple_assignment (*this);
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
297 }
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
298
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
299 // Multi-valued assignment expressions.
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
300
6253
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
301 tree_multi_assignment::tree_multi_assignment
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
302 (tree_argument_list *lst, tree_expression *r,
10230
0a5a769b8fc0 disallow computed multiple assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 10227
diff changeset
303 bool plhs, int l, int c)
0a5a769b8fc0 disallow computed multiple assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 10227
diff changeset
304 : tree_expression (l, c), lhs (lst), rhs (r), preserve (plhs),
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
305 first_execution (true) { }
6253
f1676652d808 [project @ 2007-01-24 20:43:36 by jwe]
jwe
parents: 5861
diff changeset
306
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
307 tree_multi_assignment::~tree_multi_assignment (void)
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
308 {
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
309 if (! preserve)
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
310 delete lhs;
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
311
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
312 delete rhs;
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
313 }
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
314
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
315 octave_value
8658
73c4516fae10 New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents: 8580
diff changeset
316 tree_multi_assignment::rvalue1 (int nargout)
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
317 {
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
318 octave_value retval;
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
319
8658
73c4516fae10 New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents: 8580
diff changeset
320 const octave_value_list tmp = rvalue (nargout);
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
321
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
322 if (! tmp.empty ())
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
323 retval = tmp(0);
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
324
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
325 return retval;
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
326 }
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
327
5775
ace8d8d26933 [project @ 2006-04-24 19:13:06 by jwe]
jwe
parents: 5750
diff changeset
328 // FIXME -- this works, but it would look a little better if
2984
84c33881d0bc [project @ 1997-05-16 05:14:33 by jwe]
jwe
parents: 2982
diff changeset
329 // it were broken up into a couple of separate functions.
84c33881d0bc [project @ 1997-05-16 05:14:33 by jwe]
jwe
parents: 2982
diff changeset
330
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
331 octave_value_list
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
332 tree_multi_assignment::rvalue (int)
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
333 {
3208
e8a7163701be [project @ 1998-11-03 05:12:47 by jwe]
jwe
parents: 2991
diff changeset
334 octave_value_list retval;
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
335
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
336 if (error_state)
3208
e8a7163701be [project @ 1998-11-03 05:12:47 by jwe]
jwe
parents: 2991
diff changeset
337 return retval;
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
338
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
339 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
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 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
342 {
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 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
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 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
346 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
347 }
0be8cf23b95c check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents: 8011
diff changeset
348 }
0be8cf23b95c check for obsolete built-in variable assignment at first execution rather than parse time
Jaroslav Hajek <highegg@gmail.com>
parents: 8011
diff changeset
349
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
350 if (rhs)
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
351 {
5846
db0598f94c0f [project @ 2006-06-07 18:16:16 by jwe]
jwe
parents: 5841
diff changeset
352 std::list<octave_lvalue> lvalue_list = lhs->lvalue_list ();
3977
95663a3a2682 [project @ 2002-07-05 17:43:37 by jwe]
jwe
parents: 3965
diff changeset
353
95663a3a2682 [project @ 2002-07-05 17:43:37 by jwe]
jwe
parents: 3965
diff changeset
354 if (error_state)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
355 return retval;
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
356
10832
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10315
diff changeset
357 octave_idx_type n_out = 0;
5846
db0598f94c0f [project @ 2006-06-07 18:16:16 by jwe]
jwe
parents: 5841
diff changeset
358
db0598f94c0f [project @ 2006-06-07 18:16:16 by jwe]
jwe
parents: 5841
diff changeset
359 for (std::list<octave_lvalue>::const_iterator p = lvalue_list.begin ();
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
360 p != lvalue_list.end ();
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
361 p++)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
362 n_out += p->numel ();
5846
db0598f94c0f [project @ 2006-06-07 18:16:16 by jwe]
jwe
parents: 5841
diff changeset
363
8580
188d38a553c7 further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents: 8313
diff changeset
364 // The following trick is used to keep rhs_val constant.
10832
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10315
diff changeset
365 const octave_value_list rhs_val1 = rhs->rvalue (n_out, &lvalue_list);
8580
188d38a553c7 further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents: 8313
diff changeset
366 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
367 ? rhs_val1(0).list_value () : rhs_val1);
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
368
3977
95663a3a2682 [project @ 2002-07-05 17:43:37 by jwe]
jwe
parents: 3965
diff changeset
369 if (error_state)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
370 return retval;
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
371
9782
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
372 octave_idx_type k = 0;
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
373
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
374 octave_idx_type n = rhs_val.length ();
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
375
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
376 // To avoid copying per elements and possible optimizations, we
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
377 // postpone joining the final values.
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
378 std::list<octave_value_list> retval_list;
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
379
9782
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
380 tree_argument_list::iterator q = lhs->begin ();
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
381
9782
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
382 for (std::list<octave_lvalue>::iterator p = lvalue_list.begin ();
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
383 p != lvalue_list.end ();
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
384 p++)
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
385 {
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
386 tree_expression *lhs_elt = *q++;
5846
db0598f94c0f [project @ 2006-06-07 18:16:16 by jwe]
jwe
parents: 5841
diff changeset
387
9782
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
388 octave_lvalue ult = *p;
5846
db0598f94c0f [project @ 2006-06-07 18:16:16 by jwe]
jwe
parents: 5841
diff changeset
389
9782
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
390 octave_idx_type nel = ult.numel ();
3977
95663a3a2682 [project @ 2002-07-05 17:43:37 by jwe]
jwe
parents: 3965
diff changeset
391
9782
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
392 if (nel != 1)
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
393 {
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
394 if (k + nel <= n)
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
395 {
10230
0a5a769b8fc0 disallow computed multiple assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 10227
diff changeset
396 // This won't do a copy.
0a5a769b8fc0 disallow computed multiple assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 10227
diff changeset
397 octave_value_list ovl = rhs_val.slice (k, nel);
5846
db0598f94c0f [project @ 2006-06-07 18:16:16 by jwe]
jwe
parents: 5841
diff changeset
398
10230
0a5a769b8fc0 disallow computed multiple assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 10227
diff changeset
399 ult.assign (octave_value::op_asn_eq, octave_value (ovl, true));
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
400
10230
0a5a769b8fc0 disallow computed multiple assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 10227
diff changeset
401 if (! error_state)
0a5a769b8fc0 disallow computed multiple assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 10227
diff changeset
402 {
0a5a769b8fc0 disallow computed multiple assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 10227
diff changeset
403 retval_list.push_back (ovl);
5846
db0598f94c0f [project @ 2006-06-07 18:16:16 by jwe]
jwe
parents: 5841
diff changeset
404
10230
0a5a769b8fc0 disallow computed multiple assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 10227
diff changeset
405 k += nel;
9782
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
406 }
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
407 }
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
408 else
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
409 error ("some elements undefined in return list");
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
410 }
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
411 else
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
412 {
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
413 if (k < n)
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
414 {
10230
0a5a769b8fc0 disallow computed multiple assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 10227
diff changeset
415 ult.assign (octave_value::op_asn_eq, rhs_val(k));
3977
95663a3a2682 [project @ 2002-07-05 17:43:37 by jwe]
jwe
parents: 3965
diff changeset
416
10227
d3fc22c3071c omit ~ values from multi-assignment return lists
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
417 if (ult.is_black_hole ())
d3fc22c3071c omit ~ values from multi-assignment return lists
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
418 {
d3fc22c3071c omit ~ values from multi-assignment return lists
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
419 k++;
d3fc22c3071c omit ~ values from multi-assignment return lists
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
420 continue;
d3fc22c3071c omit ~ values from multi-assignment return lists
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
421 }
d3fc22c3071c omit ~ values from multi-assignment return lists
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
422 else if (! error_state)
9782
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
423 {
10230
0a5a769b8fc0 disallow computed multiple assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 10227
diff changeset
424 retval_list.push_back (rhs_val(k));
5846
db0598f94c0f [project @ 2006-06-07 18:16:16 by jwe]
jwe
parents: 5841
diff changeset
425
9782
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
426 k++;
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
427 }
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
428 }
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
429 else
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
430 error ("element number %d undefined in return list", k+1);
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
431 }
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
432
9782
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
433 if (error_state)
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
434 break;
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
435 else if (print_result ())
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
436 {
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
437 // We clear any index here so that we can get
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
438 // the new value of the referenced object below,
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
439 // instead of the indexed value (which should be
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
440 // the same as the right hand side value).
3977
95663a3a2682 [project @ 2002-07-05 17:43:37 by jwe]
jwe
parents: 3965
diff changeset
441
9782
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
442 ult.clear_index ();
3208
e8a7163701be [project @ 1998-11-03 05:12:47 by jwe]
jwe
parents: 2991
diff changeset
443
9782
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
444 octave_value lhs_val = ult.value ();
3977
95663a3a2682 [project @ 2002-07-05 17:43:37 by jwe]
jwe
parents: 3965
diff changeset
445
9782
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
446 if (! error_state)
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
447 lhs_val.print_with_name (octave_stdout,
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
448 lhs_elt->name ());
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
449 }
3977
95663a3a2682 [project @ 2002-07-05 17:43:37 by jwe]
jwe
parents: 3965
diff changeset
450
9782
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
451 if (error_state)
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
452 break;
3977
95663a3a2682 [project @ 2002-07-05 17:43:37 by jwe]
jwe
parents: 3965
diff changeset
453
9782
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
454 }
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
455
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
456 // Concatenate return values.
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
457 retval = retval_list;
eead00a7df05 don't skip empty multi-assignments to allow side effects
Jaroslav Hajek <highegg@gmail.com>
parents: 9421
diff changeset
458
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
459 }
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
460
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
461 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
462
3208
e8a7163701be [project @ 1998-11-03 05:12:47 by jwe]
jwe
parents: 2991
diff changeset
463 return retval;
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
464 }
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
465
3536
e8fbc8c3d6d9 [project @ 2000-02-02 12:01:00 by jwe]
jwe
parents: 3534
diff changeset
466 std::string
3208
e8a7163701be [project @ 1998-11-03 05:12:47 by jwe]
jwe
parents: 2991
diff changeset
467 tree_multi_assignment::oper (void) const
e8a7163701be [project @ 1998-11-03 05:12:47 by jwe]
jwe
parents: 2991
diff changeset
468 {
10230
0a5a769b8fc0 disallow computed multiple assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 10227
diff changeset
469 return octave_value::assign_op_as_string (op_type ());
3208
e8a7163701be [project @ 1998-11-03 05:12:47 by jwe]
jwe
parents: 2991
diff changeset
470 }
e8a7163701be [project @ 1998-11-03 05:12:47 by jwe]
jwe
parents: 2991
diff changeset
471
5861
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5846
diff changeset
472 tree_expression *
7767
71f068b22fcc scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents: 7389
diff changeset
473 tree_multi_assignment::dup (symbol_table::scope_id scope,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
474 symbol_table::context_id context) const
5861
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5846
diff changeset
475 {
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5846
diff changeset
476 tree_multi_assignment *new_ma
7767
71f068b22fcc scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents: 7389
diff changeset
477 = new tree_multi_assignment (lhs ? lhs->dup (scope, context) : 0,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
478 rhs ? rhs->dup (scope, context) : 0,
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10230
diff changeset
479 preserve);
5861
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5846
diff changeset
480
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5846
diff changeset
481 new_ma->copy_base (*this);
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5846
diff changeset
482
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5846
diff changeset
483 return new_ma;
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5846
diff changeset
484 }
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5846
diff changeset
485
2980
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
486 void
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
487 tree_multi_assignment::accept (tree_walker& tw)
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
488 {
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
489 tw.visit_multi_assignment (*this);
cd5ad3fd8049 [project @ 1997-05-16 01:12:13 by jwe]
jwe
parents:
diff changeset
490 }