annotate libinterp/parse-tree/pt-walk.cc @ 27725:6388a240de87

move some common actions into tree_walker base class Instead of having most tree_walker class methods be pure virtual functions, define them to be methods that walk the tree but do nothing else. This change allows us to eliminate some duplication in derived classes, and makes it easier to define derived classes that need to walk the parse tree but onny perform actions for a few parse tree elements. * pt-walk.h, pt-walk.cc (class tree_walker): Define most methods to walk the tree. * cdef-class.cc (class ctor_analyzer): Delete methods in base class that are now handled by the base tree_walker class. * pt-anon-scopes.h, pt-anon-scopes.cc (class tree_anon_scopes): Likewise. * pt-bp.h, pt-bp.cc (tree_breakpoint): Likewise. * pt-check.h, pt-check.cc (tree_checker): Likewise. * pt-eval.h, pt-eval.cc (tree_evaluator): Likewise. * pt-jit.cc (jit_convert): Likewise. * pt-pr-code.h, pt-pr-code.cc (tree_print_code): Likewise.
author John W. Eaton <jwe@octave.org>
date Wed, 20 Nov 2019 00:01:18 -0600
parents 00f796120a6d
children b442ec6dda5c
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
26376
00f796120a6d maint: Update copyright dates in all source files.
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
3 Copyright (C) 2017-2019 John W. Eaton
23424
872f42fb26dc let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
4
872f42fb26dc let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
5 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
6
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23424
diff changeset
7 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
8 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
9 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
10 (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
11
872f42fb26dc let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
12 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
13 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
14 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
15 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
16
872f42fb26dc let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
17 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
18 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
19 <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
20
872f42fb26dc let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
21 */
872f42fb26dc let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
22
872f42fb26dc let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
23 #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
24 # include "config.h"
872f42fb26dc let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
25 #endif
872f42fb26dc let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
26
27725
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
27 #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
28
872f42fb26dc let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
29 namespace octave
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 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
32 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
33 // FIXME?
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
34 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
35
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
36 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
37 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
38 auto p = lst.begin ();
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 while (p != lst.end ())
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 tree_expression *elt = *p++;
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 if (elt)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
45 elt->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
46 }
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
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
49 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
50 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
51 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
52
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
53 if (op1)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
54 op1->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
55
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
56 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
57
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
58 if (op2)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
59 op2->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
60 }
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 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
63 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
64 visit_binary_expression (expr);
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
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
67 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
68 {
872f42fb26dc let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
69 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
70 }
872f42fb26dc let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
71
27725
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
72 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
73 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
74 // Nothing to do.
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
75 }
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
76
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
77 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
78 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
79 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
80
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
81 if (op1)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
82 op1->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
83
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
84 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
85
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
86 if (op3)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
87 op3->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
88
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
89 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
90
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
91 if (op2)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
92 op2->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
93 }
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 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
96 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
97 // Nothing to do.
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
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
100 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
101 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
102 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
103
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
104 if (init_list)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
105 init_list->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
106 }
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 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
109 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
110 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
111
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
112 if (id)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
113 id->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
114
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
115 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
116
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
117 if (expr)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
118 expr->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
119 }
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 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
122 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
123 // 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
124 // 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
125
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
126 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
127 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
128 if (elt)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
129 elt->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
130 }
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
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
133 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
134 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
135 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
136
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
137 if (lhs)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
138 lhs->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
139
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
140 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
141
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
142 if (expr)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
143 expr->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
144
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
145 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
146
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
147 if (maxproc)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
148 maxproc->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
149
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
150 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
151
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
152 if (list)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
153 list->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
154 }
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 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
157 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
158 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
159
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
160 if (lhs)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
161 lhs->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
162
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
163 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
164
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
165 if (expr)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
166 expr->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
167
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
168 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
169
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
170 if (list)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
171 list->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
172 }
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 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
175 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
176 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
177
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
178 if (cmd_list)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
179 cmd_list->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
180 }
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 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
183 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
184 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
185
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
186 if (cmd_list)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
187 cmd_list->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
188 }
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 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
191 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
192 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
193
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
194 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
195
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
196 if (f)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
197 f->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
198 }
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 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
201 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
202 // Nothing to do.
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
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
205 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
206 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
207 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
208
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
209 if (expr)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
210 expr->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
211
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
212 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
213
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
214 if (list)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
215 list->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
216 }
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 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
219 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
220 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
221
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
222 if (list)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
223 list->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
224 }
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 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
227 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
228 auto p = lst.begin ();
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 while (p != lst.end ())
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 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
233
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
234 if (elt)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
235 elt->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
236 }
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
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
239 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
240 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
241 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
242
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
243 if (label)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
244 label->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
245
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
246 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
247
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
248 if (list)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
249 list->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
250 }
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 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
253 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
254 auto p = lst.begin ();
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 while (p != lst.end ())
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 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
259
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
260 if (elt)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
261 elt->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
262 }
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
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
265 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
266 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
267 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
268
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
269 if (expr)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
270 expr->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
271
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
272 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
273
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
274 if (list)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
275 list->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
276 }
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 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
279 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
280 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
281
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
282 if (e)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
283 e->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
284
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
285 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
286
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
287 auto p = lst.begin ();
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 while (p != lst.end ())
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 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
292
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
293 if (elt)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
294 elt->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
295 }
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
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
298 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
299 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
300 auto p = lst.begin ();
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 while (p != lst.end ())
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 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
305
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
306 if (elt)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
307 elt->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
308 }
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
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
311 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
312 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
313 auto p = lst.begin ();
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 while (p != lst.end ())
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 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
318
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
319 if (elt)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
320 elt->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
321 }
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
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
324 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
325 {
27725
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
326 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
327
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
328 if (lhs)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
329 lhs->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
330
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
331 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
332
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
333 if (rhs)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
334 rhs->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
335 }
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 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
338 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
339 // Nothing to do.
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
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
342 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
343 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
344 // Nothing to do.
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
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
347 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
348 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
349 // Nothing to do.
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
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
352 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
353 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
354 auto p = lst.begin ();
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 while (p != lst.end ())
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 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
359
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
360 if (elt)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
361 elt->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
362 }
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
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
365 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
366 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
367 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
368
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
369 if (e)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
370 e->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
371 }
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 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
374 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
375 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
376
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
377 if (e)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
378 e->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
379 }
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 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
382 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
383 // Nothing to do.
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
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
386 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
387 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
388 auto p = lst.begin ();
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 while (p != lst.end ())
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 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
393
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
394 if (elt)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
395 elt->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
396 }
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
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
399 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
400 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
401 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
402
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
403 if (lhs)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
404 lhs->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
405
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
406 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
407
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
408 if (rhs)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
409 rhs->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
410 }
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 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
413 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
414 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
415
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
416 if (cmd)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
417 cmd->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
418 else
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 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
421
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
422 if (expr)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
423 expr->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
424 }
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
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
427 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
428 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
429 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
430 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
431 if (elt)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
432 elt->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
433 }
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
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
436 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
437 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
438 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
439
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
440 if (try_code)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
441 try_code->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
442
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
443 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
444
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
445 if (expr_id)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
446 expr_id->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
447
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
448 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
449
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
450 if (catch_code)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
451 catch_code->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
452 }
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 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
455 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
456 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
457
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
458 if (unwind_protect_code)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
459 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
460
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
461 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
462
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
463 if (cleanup_code)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
464 cleanup_code->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
465 }
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 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
468 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
469 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
470
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
471 if (expr)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
472 expr->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
473
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
474 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
475
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
476 if (list)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
477 list->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
478 }
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 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
481 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
482 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
483
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
484 if (list)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
485 list->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
486
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
487 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
488
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
489 if (expr)
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
490 expr->accept (*this);
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
491 }
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 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
494 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
495 // FIXME?
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
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
498 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
499 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
500 // FIXME?
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
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
503 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
504 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
505 // FIXME?
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
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
508 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
509 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
510 // FIXME?
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
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
513 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
514 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
515 // FIXME?
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
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
518 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
519 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
520 // FIXME?
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
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
523 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
524 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
525 // FIXME?
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
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
528 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
529 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
530 // FIXME?
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
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
533 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
534 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
535 // FIXME?
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
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
538 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
539 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
540 // FIXME?
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
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
543 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
544 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
545 // FIXME?
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
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
548 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
549 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
550 // FIXME?
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
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
553 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
554 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
555 // FIXME?
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
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
558 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
559 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
560 // FIXME?
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
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
563 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
564 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
565 // FIXME?
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
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
568 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
569 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
570 // FIXME?
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
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
573 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
574 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
575 // FIXME?
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
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
578 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
579 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
580 // FIXME?
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
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
583 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
584 {
6388a240de87 move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
585 // FIXME?
23424
872f42fb26dc let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
586 }
872f42fb26dc let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff changeset
587 }