annotate libinterp/parse-tree/pt-arg-list.cc @ 20622:128414587af2

don't print additional error message in argument list evaluation * pt-arg-list.cc (tree_argument_list::convert_to_const_vector): Don't call error for for failed argument evaluation.
author John W. Eaton <jwe@octave.org>
date Fri, 09 Oct 2015 16:52:49 -0400
parents 22618d5fb6ad
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
1 /*
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
2
19731
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 17787
diff changeset
3 Copyright (C) 1996-2015 John W. Eaton
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
4
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
5 This file is part of Octave.
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
6
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
8 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: 5861
diff changeset
9 Free Software Foundation; either version 3 of the License, or (at your
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5861
diff changeset
10 option) any later version.
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
11
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
15 for more details.
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
16
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
17 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: 5861
diff changeset
18 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5861
diff changeset
19 <http://www.gnu.org/licenses/>.
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
20
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
21 */
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
22
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
23 #ifdef HAVE_CONFIG_H
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
24 #include <config.h>
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
25 #endif
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
26
3503
d14c483b3c12 [project @ 2000-02-01 04:06:07 by jwe]
jwe
parents: 3162
diff changeset
27 #include <iostream>
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
28 #include <string>
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
29
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
30 #include "str-vec.h"
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
31
4234
90e44267e8cf [project @ 2002-12-21 17:15:25 by jwe]
jwe
parents: 4219
diff changeset
32 #include "defun.h"
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
33 #include "error.h"
5846
db0598f94c0f [project @ 2006-06-07 18:16:16 by jwe]
jwe
parents: 5775
diff changeset
34 #include "oct-lvalue.h"
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
35 #include "oct-obj.h"
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
36 #include "ov.h"
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
37 #include "ov-usr-fcn.h"
8136
2b2ca62f8ab6 dispatch to user-defined end function for classes if one is defined
John W. Eaton <jwe@octave.org>
parents: 7767
diff changeset
38 #include "parse.h"
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
39 #include "pt-arg-list.h"
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
40 #include "pt-exp.h"
10206
37a08e0ce2dc support Matlab-style empty output/input arguments
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
41 #include "pt-id.h"
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
42 #include "pt-pr-code.h"
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
43 #include "pt-walk.h"
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
44 #include "toplev.h"
4234
90e44267e8cf [project @ 2002-12-21 17:15:25 by jwe]
jwe
parents: 4219
diff changeset
45 #include "unwind-prot.h"
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
46
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
47 // Argument lists.
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
48
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
49 tree_argument_list::~tree_argument_list (void)
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
50 {
4219
23d06c9e1edd [project @ 2002-12-06 21:29:17 by jwe]
jwe
parents: 4212
diff changeset
51 while (! empty ())
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
52 {
4219
23d06c9e1edd [project @ 2002-12-06 21:29:17 by jwe]
jwe
parents: 4212
diff changeset
53 iterator p = begin ();
23d06c9e1edd [project @ 2002-12-06 21:29:17 by jwe]
jwe
parents: 4212
diff changeset
54 delete *p;
23d06c9e1edd [project @ 2002-12-06 21:29:17 by jwe]
jwe
parents: 4212
diff changeset
55 erase (p);
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
56 }
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
57 }
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
58
4267
7cd865a8c815 [project @ 2003-01-03 15:27:05 by jwe]
jwe
parents: 4265
diff changeset
59 bool
7cd865a8c815 [project @ 2003-01-03 15:27:05 by jwe]
jwe
parents: 4265
diff changeset
60 tree_argument_list::has_magic_end (void) const
7cd865a8c815 [project @ 2003-01-03 15:27:05 by jwe]
jwe
parents: 4265
diff changeset
61 {
7cd865a8c815 [project @ 2003-01-03 15:27:05 by jwe]
jwe
parents: 4265
diff changeset
62 for (const_iterator p = begin (); p != end (); p++)
7cd865a8c815 [project @ 2003-01-03 15:27:05 by jwe]
jwe
parents: 4265
diff changeset
63 {
7cd865a8c815 [project @ 2003-01-03 15:27:05 by jwe]
jwe
parents: 4265
diff changeset
64 tree_expression *elt = *p;
7cd865a8c815 [project @ 2003-01-03 15:27:05 by jwe]
jwe
parents: 4265
diff changeset
65
7cd865a8c815 [project @ 2003-01-03 15:27:05 by jwe]
jwe
parents: 4265
diff changeset
66 if (elt && elt->has_magic_end ())
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
67 return true;
4267
7cd865a8c815 [project @ 2003-01-03 15:27:05 by jwe]
jwe
parents: 4265
diff changeset
68 }
7cd865a8c815 [project @ 2003-01-03 15:27:05 by jwe]
jwe
parents: 4265
diff changeset
69
7cd865a8c815 [project @ 2003-01-03 15:27:05 by jwe]
jwe
parents: 4265
diff changeset
70 return false;
7cd865a8c815 [project @ 2003-01-03 15:27:05 by jwe]
jwe
parents: 4265
diff changeset
71 }
7cd865a8c815 [project @ 2003-01-03 15:27:05 by jwe]
jwe
parents: 4265
diff changeset
72
4258
b8a4496d7b24 [project @ 2003-01-02 03:45:53 by jwe]
jwe
parents: 4256
diff changeset
73 void
b8a4496d7b24 [project @ 2003-01-02 03:45:53 by jwe]
jwe
parents: 4256
diff changeset
74 tree_argument_list::append (const element_type& s)
b8a4496d7b24 [project @ 2003-01-02 03:45:53 by jwe]
jwe
parents: 4256
diff changeset
75 {
b8a4496d7b24 [project @ 2003-01-02 03:45:53 by jwe]
jwe
parents: 4256
diff changeset
76 octave_base_list<tree_expression *>::append (s);
b8a4496d7b24 [project @ 2003-01-02 03:45:53 by jwe]
jwe
parents: 4256
diff changeset
77
4267
7cd865a8c815 [project @ 2003-01-03 15:27:05 by jwe]
jwe
parents: 4265
diff changeset
78 if (! list_includes_magic_end && s && s->has_magic_end ())
7cd865a8c815 [project @ 2003-01-03 15:27:05 by jwe]
jwe
parents: 4265
diff changeset
79 list_includes_magic_end = true;
10206
37a08e0ce2dc support Matlab-style empty output/input arguments
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
80
37a08e0ce2dc support Matlab-style empty output/input arguments
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
81 if (! list_includes_magic_tilde && s && s->is_identifier ())
37a08e0ce2dc support Matlab-style empty output/input arguments
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
82 {
37a08e0ce2dc support Matlab-style empty output/input arguments
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
83 tree_identifier *id = dynamic_cast<tree_identifier *> (s);
37a08e0ce2dc support Matlab-style empty output/input arguments
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
84 list_includes_magic_tilde = id && id->is_black_hole ();
37a08e0ce2dc support Matlab-style empty output/input arguments
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
85 }
4258
b8a4496d7b24 [project @ 2003-01-02 03:45:53 by jwe]
jwe
parents: 4256
diff changeset
86 }
b8a4496d7b24 [project @ 2003-01-02 03:45:53 by jwe]
jwe
parents: 4256
diff changeset
87
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
88 bool
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
89 tree_argument_list::all_elements_are_constant (void) const
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
90 {
4219
23d06c9e1edd [project @ 2002-12-06 21:29:17 by jwe]
jwe
parents: 4212
diff changeset
91 for (const_iterator p = begin (); p != end (); p++)
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
92 {
4219
23d06c9e1edd [project @ 2002-12-06 21:29:17 by jwe]
jwe
parents: 4212
diff changeset
93 tree_expression *elt = *p;
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
94
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
95 if (! elt->is_constant ())
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
96 return false;
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
97 }
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
98
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
99 return true;
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
100 }
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
101
16285
3389152014ca improve validation of left hand side of assignment expressions in parser
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
102 bool
3389152014ca improve validation of left hand side of assignment expressions in parser
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
103 tree_argument_list::is_valid_lvalue_list (void) const
3389152014ca improve validation of left hand side of assignment expressions in parser
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
104 {
3389152014ca improve validation of left hand side of assignment expressions in parser
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
105 bool retval = true;
3389152014ca improve validation of left hand side of assignment expressions in parser
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
106
3389152014ca improve validation of left hand side of assignment expressions in parser
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
107 for (const_iterator p = begin (); p != end (); p++)
3389152014ca improve validation of left hand side of assignment expressions in parser
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
108 {
3389152014ca improve validation of left hand side of assignment expressions in parser
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
109 tree_expression *elt = *p;
3389152014ca improve validation of left hand side of assignment expressions in parser
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
110
3389152014ca improve validation of left hand side of assignment expressions in parser
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
111 // There is no need for a separate check for the magic "~" because
3389152014ca improve validation of left hand side of assignment expressions in parser
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
112 // it represented by tree_black_hole, and that is derived from
3389152014ca improve validation of left hand side of assignment expressions in parser
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
113 // tree_identifier.
3389152014ca improve validation of left hand side of assignment expressions in parser
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
114
3389152014ca improve validation of left hand side of assignment expressions in parser
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
115 if (! (elt->is_identifier () || elt->is_index_expression ()))
3389152014ca improve validation of left hand side of assignment expressions in parser
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
116 {
3389152014ca improve validation of left hand side of assignment expressions in parser
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
117 retval = false;
3389152014ca improve validation of left hand side of assignment expressions in parser
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
118 break;
3389152014ca improve validation of left hand side of assignment expressions in parser
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
119 }
3389152014ca improve validation of left hand side of assignment expressions in parser
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
120 }
3389152014ca improve validation of left hand side of assignment expressions in parser
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
121
3389152014ca improve validation of left hand side of assignment expressions in parser
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
122 return retval;
3389152014ca improve validation of left hand side of assignment expressions in parser
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
123 }
3389152014ca improve validation of left hand side of assignment expressions in parser
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
124
4234
90e44267e8cf [project @ 2002-12-21 17:15:25 by jwe]
jwe
parents: 4219
diff changeset
125 static const octave_value *indexed_object = 0;
90e44267e8cf [project @ 2002-12-21 17:15:25 by jwe]
jwe
parents: 4219
diff changeset
126 static int index_position = 0;
7751
7c020c067a60 F__end__: correctly handle fewer indices than dimensions
John W. Eaton <jwe@octave.org>
parents: 7336
diff changeset
127 static int num_indices = 0;
4234
90e44267e8cf [project @ 2002-12-21 17:15:25 by jwe]
jwe
parents: 4219
diff changeset
128
17355
f0edd6c752e9 don't convert "end" token to "__end__" for indexing
John W. Eaton <jwe@octave.org>
parents: 16755
diff changeset
129 DEFCONSTFUN (end, , ,
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17756
diff changeset
130 "-*- texinfo -*-\n\
17756
9aff1c9fd70f doc: Add missing functions to manual.
Rik <rik@octave.org>
parents: 17744
diff changeset
131 @deftypefn {Built-in Function} {} end\n\
9aff1c9fd70f doc: Add missing functions to manual.
Rik <rik@octave.org>
parents: 17744
diff changeset
132 The magic index @qcode{\"end\"} refers to the last valid entry in an indexing\n\
9aff1c9fd70f doc: Add missing functions to manual.
Rik <rik@octave.org>
parents: 17744
diff changeset
133 operation.\n\
9aff1c9fd70f doc: Add missing functions to manual.
Rik <rik@octave.org>
parents: 17744
diff changeset
134 \n\
9aff1c9fd70f doc: Add missing functions to manual.
Rik <rik@octave.org>
parents: 17744
diff changeset
135 Example:\n\
9aff1c9fd70f doc: Add missing functions to manual.
Rik <rik@octave.org>
parents: 17744
diff changeset
136 \n\
9aff1c9fd70f doc: Add missing functions to manual.
Rik <rik@octave.org>
parents: 17744
diff changeset
137 @example\n\
9aff1c9fd70f doc: Add missing functions to manual.
Rik <rik@octave.org>
parents: 17744
diff changeset
138 @group\n\
20216
aa36fb998a4d maint: Remove unnecessary whitespace at end of lines.
Rik <rik@octave.org>
parents: 19731
diff changeset
139 @var{x} = [ 1 2 3\n\
17756
9aff1c9fd70f doc: Add missing functions to manual.
Rik <rik@octave.org>
parents: 17744
diff changeset
140 4 5 6 ];\n\
9aff1c9fd70f doc: Add missing functions to manual.
Rik <rik@octave.org>
parents: 17744
diff changeset
141 @var{x}(1,end)\n\
9aff1c9fd70f doc: Add missing functions to manual.
Rik <rik@octave.org>
parents: 17744
diff changeset
142 @result{} 3\n\
9aff1c9fd70f doc: Add missing functions to manual.
Rik <rik@octave.org>
parents: 17744
diff changeset
143 @var{x}(end,1)\n\
9aff1c9fd70f doc: Add missing functions to manual.
Rik <rik@octave.org>
parents: 17744
diff changeset
144 @result{} 4\n\
9aff1c9fd70f doc: Add missing functions to manual.
Rik <rik@octave.org>
parents: 17744
diff changeset
145 @var{x}(end,end)\n\
9aff1c9fd70f doc: Add missing functions to manual.
Rik <rik@octave.org>
parents: 17744
diff changeset
146 @result{} 6\n\
9aff1c9fd70f doc: Add missing functions to manual.
Rik <rik@octave.org>
parents: 17744
diff changeset
147 @end group\n\
9aff1c9fd70f doc: Add missing functions to manual.
Rik <rik@octave.org>
parents: 17744
diff changeset
148 @end example\n\
9aff1c9fd70f doc: Add missing functions to manual.
Rik <rik@octave.org>
parents: 17744
diff changeset
149 @end deftypefn")
4234
90e44267e8cf [project @ 2002-12-21 17:15:25 by jwe]
jwe
parents: 4219
diff changeset
150 {
90e44267e8cf [project @ 2002-12-21 17:15:25 by jwe]
jwe
parents: 4219
diff changeset
151 octave_value retval;
90e44267e8cf [project @ 2002-12-21 17:15:25 by jwe]
jwe
parents: 4219
diff changeset
152
90e44267e8cf [project @ 2002-12-21 17:15:25 by jwe]
jwe
parents: 4219
diff changeset
153 if (indexed_object)
90e44267e8cf [project @ 2002-12-21 17:15:25 by jwe]
jwe
parents: 4219
diff changeset
154 {
8136
2b2ca62f8ab6 dispatch to user-defined end function for classes if one is defined
John W. Eaton <jwe@octave.org>
parents: 7767
diff changeset
155 if (indexed_object->is_object ())
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
156 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
157 octave_value_list args;
8136
2b2ca62f8ab6 dispatch to user-defined end function for classes if one is defined
John W. Eaton <jwe@octave.org>
parents: 7767
diff changeset
158
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
159 args(2) = num_indices;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
160 args(1) = index_position + 1;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
161 args(0) = *indexed_object;
8136
2b2ca62f8ab6 dispatch to user-defined end function for classes if one is defined
John W. Eaton <jwe@octave.org>
parents: 7767
diff changeset
162
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
163 std::string class_name = indexed_object->class_name ();
8136
2b2ca62f8ab6 dispatch to user-defined end function for classes if one is defined
John W. Eaton <jwe@octave.org>
parents: 7767
diff changeset
164
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
165 octave_value meth = symbol_table::find_method ("end", class_name);
8136
2b2ca62f8ab6 dispatch to user-defined end function for classes if one is defined
John W. Eaton <jwe@octave.org>
parents: 7767
diff changeset
166
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
167 if (meth.is_defined ())
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
168 return feval (meth.function_value (), args, 1);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
169 }
8136
2b2ca62f8ab6 dispatch to user-defined end function for classes if one is defined
John W. Eaton <jwe@octave.org>
parents: 7767
diff changeset
170
4671
7a80bb43ea63 [project @ 2003-11-28 02:50:12 by jwe]
jwe
parents: 4432
diff changeset
171 dim_vector dv = indexed_object->dims ();
7751
7c020c067a60 F__end__: correctly handle fewer indices than dimensions
John W. Eaton <jwe@octave.org>
parents: 7336
diff changeset
172 int ndims = dv.length ();
4671
7a80bb43ea63 [project @ 2003-11-28 02:50:12 by jwe]
jwe
parents: 4432
diff changeset
173
7751
7c020c067a60 F__end__: correctly handle fewer indices than dimensions
John W. Eaton <jwe@octave.org>
parents: 7336
diff changeset
174 if (num_indices < ndims)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
175 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
176 for (int i = num_indices; i < ndims; i++)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
177 dv(num_indices-1) *= dv(i);
4256
2b9c6dc25449 [project @ 2002-12-31 21:48:54 by jwe]
jwe
parents: 4255
diff changeset
178
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
179 if (num_indices == 1)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
180 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
181 ndims = 2;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
182 dv.resize (ndims);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
183 dv(1) = 1;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
184 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
185 else
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
186 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
187 ndims = num_indices;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
188 dv.resize (ndims);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
189 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
190 }
4234
90e44267e8cf [project @ 2002-12-21 17:15:25 by jwe]
jwe
parents: 4219
diff changeset
191
7751
7c020c067a60 F__end__: correctly handle fewer indices than dimensions
John W. Eaton <jwe@octave.org>
parents: 7336
diff changeset
192 if (index_position < ndims)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
193 retval = dv(index_position);
7751
7c020c067a60 F__end__: correctly handle fewer indices than dimensions
John W. Eaton <jwe@octave.org>
parents: 7336
diff changeset
194 else
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
195 retval = 1;
4234
90e44267e8cf [project @ 2002-12-21 17:15:25 by jwe]
jwe
parents: 4219
diff changeset
196 }
90e44267e8cf [project @ 2002-12-21 17:15:25 by jwe]
jwe
parents: 4219
diff changeset
197 else
20463
7ac907da9fba Use error() rather than ::error() unless explicitly required.
Rik <rik@octave.org>
parents: 20216
diff changeset
198 error ("invalid use of end");
4234
90e44267e8cf [project @ 2002-12-21 17:15:25 by jwe]
jwe
parents: 4219
diff changeset
199
90e44267e8cf [project @ 2002-12-21 17:15:25 by jwe]
jwe
parents: 4219
diff changeset
200 return retval;
90e44267e8cf [project @ 2002-12-21 17:15:25 by jwe]
jwe
parents: 4219
diff changeset
201 }
90e44267e8cf [project @ 2002-12-21 17:15:25 by jwe]
jwe
parents: 4219
diff changeset
202
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
203 octave_value_list
4234
90e44267e8cf [project @ 2002-12-21 17:15:25 by jwe]
jwe
parents: 4219
diff changeset
204 tree_argument_list::convert_to_const_vector (const octave_value *object)
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
205 {
4256
2b9c6dc25449 [project @ 2002-12-31 21:48:54 by jwe]
jwe
parents: 4255
diff changeset
206 // END doesn't make sense for functions. Maybe we need a different
2b9c6dc25449 [project @ 2002-12-31 21:48:54 by jwe]
jwe
parents: 4255
diff changeset
207 // way of asking an octave_value object this question?
2b9c6dc25449 [project @ 2002-12-31 21:48:54 by jwe]
jwe
parents: 4255
diff changeset
208
4258
b8a4496d7b24 [project @ 2003-01-02 03:45:53 by jwe]
jwe
parents: 4256
diff changeset
209 bool stash_object = (list_includes_magic_end
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
210 && object
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
211 && ! (object->is_function ()
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
212 || object->is_function_handle ()));
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
213
10066
2cd940306a06 make unwind_protect frames local
Jaroslav Hajek <highegg@gmail.com>
parents: 9702
diff changeset
214 unwind_protect frame;
4234
90e44267e8cf [project @ 2002-12-21 17:15:25 by jwe]
jwe
parents: 4219
diff changeset
215
4256
2b9c6dc25449 [project @ 2002-12-31 21:48:54 by jwe]
jwe
parents: 4255
diff changeset
216 if (stash_object)
2b9c6dc25449 [project @ 2002-12-31 21:48:54 by jwe]
jwe
parents: 4255
diff changeset
217 {
10066
2cd940306a06 make unwind_protect frames local
Jaroslav Hajek <highegg@gmail.com>
parents: 9702
diff changeset
218 frame.protect_var (indexed_object);
4256
2b9c6dc25449 [project @ 2002-12-31 21:48:54 by jwe]
jwe
parents: 4255
diff changeset
219
2b9c6dc25449 [project @ 2002-12-31 21:48:54 by jwe]
jwe
parents: 4255
diff changeset
220 indexed_object = object;
2b9c6dc25449 [project @ 2002-12-31 21:48:54 by jwe]
jwe
parents: 4255
diff changeset
221 }
4234
90e44267e8cf [project @ 2002-12-21 17:15:25 by jwe]
jwe
parents: 4219
diff changeset
222
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
223 int len = length ();
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
224
8580
188d38a553c7 further indexing optimization touches
Jaroslav Hajek <highegg@gmail.com>
parents: 8173
diff changeset
225 std::list<octave_value_list> args;
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
226
4219
23d06c9e1edd [project @ 2002-12-06 21:29:17 by jwe]
jwe
parents: 4212
diff changeset
227 iterator p = begin ();
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
228 for (int k = 0; k < len; k++)
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
229 {
4974
ff29117ce225 [project @ 2004-09-08 17:23:22 by jwe]
jwe
parents: 4671
diff changeset
230 if (stash_object)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
231 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
232 frame.protect_var (index_position);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
233 frame.protect_var (num_indices);
4974
ff29117ce225 [project @ 2004-09-08 17:23:22 by jwe]
jwe
parents: 4671
diff changeset
234
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
235 index_position = k;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
236 num_indices = len;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
237 }
4234
90e44267e8cf [project @ 2002-12-21 17:15:25 by jwe]
jwe
parents: 4219
diff changeset
238
4219
23d06c9e1edd [project @ 2002-12-06 21:29:17 by jwe]
jwe
parents: 4212
diff changeset
239 tree_expression *elt = *p++;
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
240
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
241 if (elt)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
242 {
20622
128414587af2 don't print additional error message in argument list evaluation
John W. Eaton <jwe@octave.org>
parents: 20621
diff changeset
243 octave_value tmp = elt->rvalue1 ();
20621
22618d5fb6ad eliminate remaining uses of error_state in parse-tree files
John W. Eaton <jwe@octave.org>
parents: 20463
diff changeset
244
20622
128414587af2 don't print additional error message in argument list evaluation
John W. Eaton <jwe@octave.org>
parents: 20621
diff changeset
245 if (tmp.is_cs_list ())
128414587af2 don't print additional error message in argument list evaluation
John W. Eaton <jwe@octave.org>
parents: 20621
diff changeset
246 args.push_back (tmp.list_value ());
128414587af2 don't print additional error message in argument list evaluation
John W. Eaton <jwe@octave.org>
parents: 20621
diff changeset
247 else if (tmp.is_defined ())
128414587af2 don't print additional error message in argument list evaluation
John W. Eaton <jwe@octave.org>
parents: 20621
diff changeset
248 args.push_back (tmp);
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
249 }
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
250 else
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
251 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
252 args.push_back (octave_value ());
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
253 break;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
254 }
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
255 }
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
256
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
257 return args;
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
258 }
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
259
5846
db0598f94c0f [project @ 2006-06-07 18:16:16 by jwe]
jwe
parents: 5775
diff changeset
260 std::list<octave_lvalue>
db0598f94c0f [project @ 2006-06-07 18:16:16 by jwe]
jwe
parents: 5775
diff changeset
261 tree_argument_list::lvalue_list (void)
db0598f94c0f [project @ 2006-06-07 18:16:16 by jwe]
jwe
parents: 5775
diff changeset
262 {
db0598f94c0f [project @ 2006-06-07 18:16:16 by jwe]
jwe
parents: 5775
diff changeset
263 std::list<octave_lvalue> retval;
db0598f94c0f [project @ 2006-06-07 18:16:16 by jwe]
jwe
parents: 5775
diff changeset
264
db0598f94c0f [project @ 2006-06-07 18:16:16 by jwe]
jwe
parents: 5775
diff changeset
265 for (tree_argument_list::iterator p = begin ();
db0598f94c0f [project @ 2006-06-07 18:16:16 by jwe]
jwe
parents: 5775
diff changeset
266 p != end ();
db0598f94c0f [project @ 2006-06-07 18:16:16 by jwe]
jwe
parents: 5775
diff changeset
267 p++)
db0598f94c0f [project @ 2006-06-07 18:16:16 by jwe]
jwe
parents: 5775
diff changeset
268 {
db0598f94c0f [project @ 2006-06-07 18:16:16 by jwe]
jwe
parents: 5775
diff changeset
269 tree_expression *elt = *p;
db0598f94c0f [project @ 2006-06-07 18:16:16 by jwe]
jwe
parents: 5775
diff changeset
270
db0598f94c0f [project @ 2006-06-07 18:16:16 by jwe]
jwe
parents: 5775
diff changeset
271 retval.push_back (elt->lvalue ());
db0598f94c0f [project @ 2006-06-07 18:16:16 by jwe]
jwe
parents: 5775
diff changeset
272 }
db0598f94c0f [project @ 2006-06-07 18:16:16 by jwe]
jwe
parents: 5775
diff changeset
273
db0598f94c0f [project @ 2006-06-07 18:16:16 by jwe]
jwe
parents: 5775
diff changeset
274 return retval;
db0598f94c0f [project @ 2006-06-07 18:16:16 by jwe]
jwe
parents: 5775
diff changeset
275 }
db0598f94c0f [project @ 2006-06-07 18:16:16 by jwe]
jwe
parents: 5775
diff changeset
276
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
277 string_vector
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
278 tree_argument_list::get_arg_names (void) const
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
279 {
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
280 int len = length ();
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
281
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
282 string_vector retval (len);
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
283
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
284 int k = 0;
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
285
4219
23d06c9e1edd [project @ 2002-12-06 21:29:17 by jwe]
jwe
parents: 4212
diff changeset
286 for (const_iterator p = begin (); p != end (); p++)
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
287 {
4219
23d06c9e1edd [project @ 2002-12-06 21:29:17 by jwe]
jwe
parents: 4212
diff changeset
288 tree_expression *elt = *p;
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
289
2991
fc751d2a99fd [project @ 1997-05-16 21:00:48 by jwe]
jwe
parents: 2982
diff changeset
290 retval(k++) = elt->str_print_code ();
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
291 }
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
292
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
293 return retval;
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
294 }
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
295
16360
11115c237231 recognize variables when parsing (bug #38576)
John W. Eaton <jwe@octave.org>
parents: 16285
diff changeset
296 std::list<std::string>
11115c237231 recognize variables when parsing (bug #38576)
John W. Eaton <jwe@octave.org>
parents: 16285
diff changeset
297 tree_argument_list::variable_names (void) const
11115c237231 recognize variables when parsing (bug #38576)
John W. Eaton <jwe@octave.org>
parents: 16285
diff changeset
298 {
11115c237231 recognize variables when parsing (bug #38576)
John W. Eaton <jwe@octave.org>
parents: 16285
diff changeset
299 std::list<std::string> retval;
11115c237231 recognize variables when parsing (bug #38576)
John W. Eaton <jwe@octave.org>
parents: 16285
diff changeset
300
11115c237231 recognize variables when parsing (bug #38576)
John W. Eaton <jwe@octave.org>
parents: 16285
diff changeset
301 for (const_iterator p = begin (); p != end (); p++)
11115c237231 recognize variables when parsing (bug #38576)
John W. Eaton <jwe@octave.org>
parents: 16285
diff changeset
302 {
11115c237231 recognize variables when parsing (bug #38576)
John W. Eaton <jwe@octave.org>
parents: 16285
diff changeset
303 tree_expression *elt = *p;
11115c237231 recognize variables when parsing (bug #38576)
John W. Eaton <jwe@octave.org>
parents: 16285
diff changeset
304
11115c237231 recognize variables when parsing (bug #38576)
John W. Eaton <jwe@octave.org>
parents: 16285
diff changeset
305 if (elt->is_identifier ())
11115c237231 recognize variables when parsing (bug #38576)
John W. Eaton <jwe@octave.org>
parents: 16285
diff changeset
306 {
11115c237231 recognize variables when parsing (bug #38576)
John W. Eaton <jwe@octave.org>
parents: 16285
diff changeset
307 tree_identifier *id = dynamic_cast<tree_identifier *> (elt);
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17756
diff changeset
308
16360
11115c237231 recognize variables when parsing (bug #38576)
John W. Eaton <jwe@octave.org>
parents: 16285
diff changeset
309 retval.push_back (id->name ());
11115c237231 recognize variables when parsing (bug #38576)
John W. Eaton <jwe@octave.org>
parents: 16285
diff changeset
310 }
16755
787168f5f858 tag symbols in indexed assignments as variables (bug #39240)
John W. Eaton <jwe@octave.org>
parents: 16360
diff changeset
311 else if (elt->is_index_expression ())
787168f5f858 tag symbols in indexed assignments as variables (bug #39240)
John W. Eaton <jwe@octave.org>
parents: 16360
diff changeset
312 {
787168f5f858 tag symbols in indexed assignments as variables (bug #39240)
John W. Eaton <jwe@octave.org>
parents: 16360
diff changeset
313 tree_index_expression *idx_expr
787168f5f858 tag symbols in indexed assignments as variables (bug #39240)
John W. Eaton <jwe@octave.org>
parents: 16360
diff changeset
314 = dynamic_cast<tree_index_expression *> (elt);
787168f5f858 tag symbols in indexed assignments as variables (bug #39240)
John W. Eaton <jwe@octave.org>
parents: 16360
diff changeset
315
787168f5f858 tag symbols in indexed assignments as variables (bug #39240)
John W. Eaton <jwe@octave.org>
parents: 16360
diff changeset
316 retval.push_back (idx_expr->name ());
787168f5f858 tag symbols in indexed assignments as variables (bug #39240)
John W. Eaton <jwe@octave.org>
parents: 16360
diff changeset
317 }
16360
11115c237231 recognize variables when parsing (bug #38576)
John W. Eaton <jwe@octave.org>
parents: 16285
diff changeset
318 }
11115c237231 recognize variables when parsing (bug #38576)
John W. Eaton <jwe@octave.org>
parents: 16285
diff changeset
319
11115c237231 recognize variables when parsing (bug #38576)
John W. Eaton <jwe@octave.org>
parents: 16285
diff changeset
320 return retval;
11115c237231 recognize variables when parsing (bug #38576)
John W. Eaton <jwe@octave.org>
parents: 16285
diff changeset
321 }
11115c237231 recognize variables when parsing (bug #38576)
John W. Eaton <jwe@octave.org>
parents: 16285
diff changeset
322
5861
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5848
diff changeset
323 tree_argument_list *
7767
71f068b22fcc scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents: 7751
diff changeset
324 tree_argument_list::dup (symbol_table::scope_id scope,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10206
diff changeset
325 symbol_table::context_id context) const
5861
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5848
diff changeset
326 {
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5848
diff changeset
327 tree_argument_list *new_list = new tree_argument_list ();
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5848
diff changeset
328
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5848
diff changeset
329 new_list->list_includes_magic_end = list_includes_magic_end;
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5848
diff changeset
330 new_list->simple_assign_lhs = simple_assign_lhs;
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5848
diff changeset
331
8913
35cd375d4bb3 make tree::dup functions const
John W. Eaton <jwe@octave.org>
parents: 8658
diff changeset
332 for (const_iterator p = begin (); p != end (); p++)
5861
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5848
diff changeset
333 {
8913
35cd375d4bb3 make tree::dup functions const
John W. Eaton <jwe@octave.org>
parents: 8658
diff changeset
334 const tree_expression *elt = *p;
5861
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5848
diff changeset
335
7767
71f068b22fcc scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents: 7751
diff changeset
336 new_list->append (elt ? elt->dup (scope, context) : 0);
5861
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5848
diff changeset
337 }
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5848
diff changeset
338
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5848
diff changeset
339 return new_list;
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5848
diff changeset
340 }
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5848
diff changeset
341
2982
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
342 void
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
343 tree_argument_list::accept (tree_walker& tw)
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
344 {
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
345 tw.visit_argument_list (*this);
20f5cec4f11c [project @ 1997-05-16 03:29:26 by jwe]
jwe
parents:
diff changeset
346 }