annotate libinterp/parse-tree/pt-walk.cc @ 27919:1891570abac8

update Octave Project Developers copyright for the new year In files that have the "Octave Project Developers" copyright notice, update for 2020.
author John W. Eaton <jwe@octave.org>
date Mon, 06 Jan 2020 22:29:51 -0500
parents b442ec6dda5c
children bd51beb6205e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
23424
872f42fb26dc let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1 /*
872f42fb26dc let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
2
27919
1891570abac8 update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 27918
diff changeset
3 Copyright (C) 2017-2020 The Octave Project Developers
27918
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 27725
diff changeset
4
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 27725
diff changeset
5 See the file COPYRIGHT.md in the top-level directory of this distribution
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 27725
diff changeset
6 or <https://octave.org/COPYRIGHT.html/>.
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 27725
diff changeset
7
23424
872f42fb26dc let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
8
872f42fb26dc let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
9 This file is part of Octave.
872f42fb26dc let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
10
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23424
diff changeset
11 Octave is free software: you can redistribute it and/or modify it
23424
872f42fb26dc let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
12 under the terms of the GNU General Public License as published by
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23424
diff changeset
13 the Free Software Foundation, either version 3 of the License, or
23424
872f42fb26dc let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
14 (at your option) any later version.
872f42fb26dc let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
15
872f42fb26dc let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
16 Octave is distributed in the hope that it will be useful, but
872f42fb26dc let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
17 WITHOUT ANY WARRANTY; without even the implied warranty of
872f42fb26dc let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
872f42fb26dc let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
19 GNU General Public License for more details.
872f42fb26dc let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
20
872f42fb26dc let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
21 You should have received a copy of the GNU General Public License
872f42fb26dc let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
22 along with Octave; see the file COPYING. If not, see
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23424
diff changeset
23 <https://www.gnu.org/licenses/>.
23424
872f42fb26dc let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
24
872f42fb26dc let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
25 */
872f42fb26dc let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
26
872f42fb26dc let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
27 #if defined (HAVE_CONFIG_H)
872f42fb26dc let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
28 # include "config.h"
872f42fb26dc let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
29 #endif
872f42fb26dc let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
30
27725
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
31 #include "pt-all.h"
23424
872f42fb26dc let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
32
872f42fb26dc let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
33 namespace octave
872f42fb26dc let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
34 {
27725
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
35 void tree_walker::visit_anon_fcn_handle (tree_anon_fcn_handle&)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
36 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
37 // FIXME?
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
38 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
39
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
40 void tree_walker::visit_argument_list (tree_argument_list& lst)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
41 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
42 auto p = lst.begin ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
43
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
44 while (p != lst.end ())
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
45 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
46 tree_expression *elt = *p++;
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
47
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
48 if (elt)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
49 elt->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
50 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
51 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
52
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
53 void tree_walker::visit_binary_expression (tree_binary_expression& expr)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
54 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
55 tree_expression *op1 = expr.lhs ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
56
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
57 if (op1)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
58 op1->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
59
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
60 tree_expression *op2 = expr.rhs ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
61
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
62 if (op2)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
63 op2->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
64 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
65
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
66 void tree_walker::visit_boolean_expression (tree_boolean_expression& expr)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
67 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
68 visit_binary_expression (expr);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
69 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
70
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
71 void tree_walker::visit_compound_binary_expression (tree_compound_binary_expression& expr)
23424
872f42fb26dc let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
72 {
872f42fb26dc let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
73 visit_binary_expression (expr);
872f42fb26dc let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
74 }
872f42fb26dc let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
75
27725
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
76 void tree_walker::visit_break_command (tree_break_command&)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
77 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
78 // Nothing to do.
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
79 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
80
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
81 void tree_walker::visit_colon_expression (tree_colon_expression& expr)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
82 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
83 tree_expression *op1 = expr.base ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
84
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
85 if (op1)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
86 op1->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
87
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
88 tree_expression *op3 = expr.increment ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
89
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
90 if (op3)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
91 op3->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
92
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
93 tree_expression *op2 = expr.limit ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
94
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
95 if (op2)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
96 op2->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
97 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
98
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
99 void tree_walker::visit_continue_command (tree_continue_command&)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
100 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
101 // Nothing to do.
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
102 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
103
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
104 void tree_walker::visit_decl_command (tree_decl_command& cmd)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
105 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
106 tree_decl_init_list *init_list = cmd.initializer_list ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
107
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
108 if (init_list)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
109 init_list->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
110 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
111
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
112 void tree_walker::visit_decl_elt (tree_decl_elt& cmd)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
113 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
114 tree_identifier *id = cmd.ident ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
115
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
116 if (id)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
117 id->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
118
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
119 tree_expression *expr = cmd.expression ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
120
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
121 if (expr)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
122 expr->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
123 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
124
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
125 void tree_walker::visit_decl_init_list (tree_decl_init_list& lst)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
126 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
127 // FIXME: tree_decl_elt is not derived from tree, so should it
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
128 // really have an accept method?
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
129
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
130 for (tree_decl_elt *elt : lst)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
131 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
132 if (elt)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
133 elt->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
134 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
135 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
136
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
137 void tree_walker::visit_simple_for_command (tree_simple_for_command& cmd)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
138 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
139 tree_expression *lhs = cmd.left_hand_side ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
140
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
141 if (lhs)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
142 lhs->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
143
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
144 tree_expression *expr = cmd.control_expr ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
145
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
146 if (expr)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
147 expr->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
148
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
149 tree_expression *maxproc = cmd.maxproc_expr ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
150
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
151 if (maxproc)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
152 maxproc->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
153
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
154 tree_statement_list *list = cmd.body ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
155
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
156 if (list)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
157 list->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
158 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
159
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
160 void tree_walker::visit_complex_for_command (tree_complex_for_command& cmd)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
161 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
162 tree_argument_list *lhs = cmd.left_hand_side ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
163
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
164 if (lhs)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
165 lhs->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
166
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
167 tree_expression *expr = cmd.control_expr ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
168
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
169 if (expr)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
170 expr->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
171
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
172 tree_statement_list *list = cmd.body ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
173
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
174 if (list)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
175 list->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
176 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
177
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
178 void tree_walker::visit_octave_user_script (octave_user_script& fcn)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
179 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
180 tree_statement_list *cmd_list = fcn.body ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
181
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
182 if (cmd_list)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
183 cmd_list->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
184 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
185
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
186 void tree_walker::visit_octave_user_function (octave_user_function& fcn)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
187 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
188 tree_statement_list *cmd_list = fcn.body ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
189
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
190 if (cmd_list)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
191 cmd_list->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
192 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
193
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
194 void tree_walker::visit_function_def (tree_function_def& fdef)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
195 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
196 octave_value fcn = fdef.function ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
197
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
198 octave_function *f = fcn.function_value ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
199
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
200 if (f)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
201 f->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
202 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
203
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
204 void tree_walker::visit_identifier (tree_identifier&)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
205 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
206 // Nothing to do.
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
207 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
208
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
209 void tree_walker::visit_if_clause (tree_if_clause& cmd)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
210 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
211 tree_expression *expr = cmd.condition ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
212
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
213 if (expr)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
214 expr->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
215
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
216 tree_statement_list *list = cmd.commands ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
217
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
218 if (list)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
219 list->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
220 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
221
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
222 void tree_walker::visit_if_command (tree_if_command& cmd)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
223 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
224 tree_if_command_list *list = cmd.cmd_list ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
225
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
226 if (list)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
227 list->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
228 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
229
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
230 void tree_walker::visit_if_command_list (tree_if_command_list& lst)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
231 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
232 auto p = lst.begin ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
233
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
234 while (p != lst.end ())
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
235 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
236 tree_if_clause *elt = *p++;
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
237
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
238 if (elt)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
239 elt->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
240 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
241 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
242
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
243 void tree_walker::visit_switch_case (tree_switch_case& cs)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
244 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
245 tree_expression *label = cs.case_label ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
246
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
247 if (label)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
248 label->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
249
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
250 tree_statement_list *list = cs.commands ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
251
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
252 if (list)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
253 list->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
254 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
255
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
256 void tree_walker::visit_switch_case_list (tree_switch_case_list& lst)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
257 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
258 auto p = lst.begin ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
259
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
260 while (p != lst.end ())
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
261 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
262 tree_switch_case *elt = *p++;
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
263
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
264 if (elt)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
265 elt->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
266 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
267 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
268
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
269 void tree_walker::visit_switch_command (tree_switch_command& cmd)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
270 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
271 tree_expression *expr = cmd.switch_value ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
272
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
273 if (expr)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
274 expr->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
275
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
276 tree_switch_case_list *list = cmd.case_list ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
277
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
278 if (list)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
279 list->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
280 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
281
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
282 void tree_walker::visit_index_expression (tree_index_expression& expr)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
283 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
284 tree_expression *e = expr.expression ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
285
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
286 if (e)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
287 e->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
288
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
289 std::list<tree_argument_list *> lst = expr.arg_lists ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
290
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
291 auto p = lst.begin ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
292
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
293 while (p != lst.end ())
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
294 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
295 tree_argument_list *elt = *p++;
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
296
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
297 if (elt)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
298 elt->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
299 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
300 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
301
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
302 void tree_walker::visit_matrix (tree_matrix& lst)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
303 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
304 auto p = lst.begin ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
305
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
306 while (p != lst.end ())
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
307 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
308 tree_argument_list *elt = *p++;
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
309
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
310 if (elt)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
311 elt->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
312 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
313 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
314
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
315 void tree_walker::visit_cell (tree_cell& lst)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
316 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
317 auto p = lst.begin ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
318
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
319 while (p != lst.end ())
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
320 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
321 tree_argument_list *elt = *p++;
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
322
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
323 if (elt)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
324 elt->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
325 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
326 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
327
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
328 void tree_walker::visit_multi_assignment (tree_multi_assignment& expr)
23424
872f42fb26dc let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
329 {
27725
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
330 tree_argument_list *lhs = expr.left_hand_side ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
331
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
332 if (lhs)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
333 lhs->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
334
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
335 tree_expression *rhs = expr.right_hand_side ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
336
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
337 if (rhs)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
338 rhs->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
339 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
340
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
341 void tree_walker::visit_no_op_command (tree_no_op_command&)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
342 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
343 // Nothing to do.
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
344 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
345
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
346 void tree_walker::visit_constant (tree_constant&)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
347 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
348 // Nothing to do.
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
349 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
350
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
351 void tree_walker::visit_fcn_handle (tree_fcn_handle&)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
352 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
353 // Nothing to do.
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
354 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
355
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
356 void tree_walker::visit_parameter_list (tree_parameter_list& lst)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
357 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
358 auto p = lst.begin ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
359
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
360 while (p != lst.end ())
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
361 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
362 tree_decl_elt *elt = *p++;
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
363
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
364 if (elt)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
365 elt->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
366 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
367 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
368
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
369 void tree_walker::visit_postfix_expression (tree_postfix_expression& expr)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
370 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
371 tree_expression *e = expr.operand ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
372
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
373 if (e)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
374 e->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
375 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
376
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
377 void tree_walker::visit_prefix_expression (tree_prefix_expression& expr)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
378 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
379 tree_expression *e = expr.operand ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
380
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
381 if (e)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
382 e->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
383 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
384
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
385 void tree_walker::visit_return_command (tree_return_command&)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
386 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
387 // Nothing to do.
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
388 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
389
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
390 void tree_walker::visit_return_list (tree_return_list& lst)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
391 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
392 auto p = lst.begin ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
393
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
394 while (p != lst.end ())
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
395 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
396 tree_index_expression *elt = *p++;
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
397
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
398 if (elt)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
399 elt->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
400 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
401 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
402
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
403 void tree_walker::visit_simple_assignment (tree_simple_assignment& expr)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
404 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
405 tree_expression *lhs = expr.left_hand_side ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
406
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
407 if (lhs)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
408 lhs->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
409
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
410 tree_expression *rhs = expr.right_hand_side ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
411
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
412 if (rhs)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
413 rhs->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
414 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
415
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
416 void tree_walker::visit_statement (tree_statement& stmt)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
417 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
418 tree_command *cmd = stmt.command ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
419
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
420 if (cmd)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
421 cmd->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
422 else
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
423 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
424 tree_expression *expr = stmt.expression ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
425
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
426 if (expr)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
427 expr->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
428 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
429 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
430
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
431 void tree_walker::visit_statement_list (tree_statement_list& lst)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
432 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
433 for (tree_statement *elt : lst)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
434 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
435 if (elt)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
436 elt->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
437 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
438 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
439
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
440 void tree_walker::visit_try_catch_command (tree_try_catch_command& cmd)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
441 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
442 tree_statement_list *try_code = cmd.body ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
443
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
444 if (try_code)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
445 try_code->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
446
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
447 tree_identifier *expr_id = cmd.identifier ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
448
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
449 if (expr_id)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
450 expr_id->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
451
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
452 tree_statement_list *catch_code = cmd.cleanup ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
453
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
454 if (catch_code)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
455 catch_code->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
456 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
457
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
458 void tree_walker::visit_unwind_protect_command (tree_unwind_protect_command& cmd)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
459 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
460 tree_statement_list *unwind_protect_code = cmd.body ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
461
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
462 if (unwind_protect_code)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
463 unwind_protect_code->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
464
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
465 tree_statement_list *cleanup_code = cmd.cleanup ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
466
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
467 if (cleanup_code)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
468 cleanup_code->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
469 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
470
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
471 void tree_walker::visit_while_command (tree_while_command& cmd)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
472 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
473 tree_expression *expr = cmd.condition ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
474
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
475 if (expr)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
476 expr->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
477
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
478 tree_statement_list *list = cmd.body ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
479
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
480 if (list)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
481 list->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
482 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
483
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
484 void tree_walker::visit_do_until_command (tree_do_until_command& cmd)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
485 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
486 tree_statement_list *list = cmd.body ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
487
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
488 if (list)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
489 list->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
490
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
491 tree_expression *expr = cmd.condition ();
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
492
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
493 if (expr)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
494 expr->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
495 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
496
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
497 void tree_walker::visit_superclass_ref (tree_superclass_ref&)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
498 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
499 // FIXME?
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
500 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
501
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
502 void tree_walker::visit_metaclass_query (tree_metaclass_query&)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
503 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
504 // FIXME?
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
505 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
506
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
507 void tree_walker::visit_classdef_attribute (tree_classdef_attribute&)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
508 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
509 // FIXME?
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
510 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
511
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
512 void tree_walker::visit_classdef_attribute_list (tree_classdef_attribute_list&)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
513 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
514 // FIXME?
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
515 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
516
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
517 void tree_walker::visit_classdef_superclass (tree_classdef_superclass&)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
518 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
519 // FIXME?
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
520 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
521
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
522 void tree_walker::visit_classdef_superclass_list (tree_classdef_superclass_list&)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
523 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
524 // FIXME?
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
525 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
526
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
527 void tree_walker::visit_classdef_property (tree_classdef_property&)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
528 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
529 // FIXME?
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
530 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
531
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
532 void tree_walker::visit_classdef_property_list (tree_classdef_property_list&)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
533 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
534 // FIXME?
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
535 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
536
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
537 void tree_walker::visit_classdef_properties_block (tree_classdef_properties_block&)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
538 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
539 // FIXME?
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
540 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
541
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
542 void tree_walker::visit_classdef_methods_list (tree_classdef_methods_list&)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
543 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
544 // FIXME?
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
545 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
546
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
547 void tree_walker::visit_classdef_methods_block (tree_classdef_methods_block&)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
548 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
549 // FIXME?
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
550 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
551
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
552 void tree_walker::visit_classdef_event (tree_classdef_event&)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
553 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
554 // FIXME?
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
555 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
556
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
557 void tree_walker::visit_classdef_events_list (tree_classdef_events_list&)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
558 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
559 // FIXME?
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
560 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
561
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
562 void tree_walker::visit_classdef_events_block (tree_classdef_events_block&)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
563 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
564 // FIXME?
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
565 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
566
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
567 void tree_walker::visit_classdef_enum (tree_classdef_enum&)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
568 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
569 // FIXME?
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
570 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
571
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
572 void tree_walker::visit_classdef_enum_list (tree_classdef_enum_list&)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
573 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
574 // FIXME?
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
575 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
576
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
577 void tree_walker::visit_classdef_enum_block (tree_classdef_enum_block&)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
578 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
579 // FIXME?
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
580 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
581
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
582 void tree_walker::visit_classdef_body (tree_classdef_body&)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
583 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
584 // FIXME?
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
585 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
586
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
587 void tree_walker::visit_classdef (tree_classdef&)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
588 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
589 // FIXME?
23424
872f42fb26dc let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
590 }
872f42fb26dc let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
591 }