Mercurial > octave
annotate libinterp/parse-tree/pt-walk.cc @ 29863:c29cfcf7a941
provide default definitions for more tree_walker methods
For parse tree elements that are primarily containers of other
elements, provide default methods that iterate over their contents.
* pt-walk.cc (tree_walker::visit_anon_fcn_handle,
tree_walker::visit_arguments_block,
tree_walker::visit_args_block_attribute_list,
tree_walker::visit_args_block_validation_list,
tree_walker::visit_arg_validation,
tree_walker::visit_arg_size_spec,
tree_walker::visit_arg_validation_fcns,
tree_walker::visit_classdef_attribute,
tree_walker::visit_classdef_attribute_list,
tree_walker::visit_classdef_superclass_list,
tree_walker::visit_classdef_property_list,
tree_walker::visit_classdef_properties_block,
tree_walker::visit_classdef_methods_list,
tree_walker::visit_classdef_methods_block,
tree_walker::visit_classdef_events_list,
tree_walker::visit_classdef_events_block,
tree_walker::visit_classdef_enum_list,
tree_walker::visit_classdef_enum_block,
tree_walker::visit_classdef_body, tree_walker::visit_classdef):
Call accept for all sub-elements.
* pt-args-block.h (tree_args_block_attribute_list::attribute,
tree_arg_size_spec::size_args, tree_arg_validation_fcns::fcn_args,
tree_arguments_block::attribute_list,
tree_arguments_block::validation_list): New functions.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 09 Jul 2021 04:03:36 -0400 |
parents | c19f8cbe0fd5 |
children | a61e1a0f6024 |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 //////////////////////////////////////////////////////////////////////// |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 // |
29358
0a5b15007766
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
28317
diff
changeset
|
3 // Copyright (C) 2017-2021 The Octave Project Developers |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
4 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 // See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 // distribution or <https://octave.org/copyright/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
7 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
8 // This file is part of Octave. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
9 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
10 // Octave is free software: you can redistribute it and/or modify it |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
11 // under the terms of the GNU General Public License as published by |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
12 // the Free Software Foundation, either version 3 of the License, or |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
13 // (at your option) any later version. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
14 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
15 // Octave is distributed in the hope that it will be useful, but |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
16 // WITHOUT ANY WARRANTY; without even the implied warranty of |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
18 // GNU General Public License for more details. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
19 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
20 // You should have received a copy of the GNU General Public License |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
21 // along with Octave; see the file COPYING. If not, see |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
22 // <https://www.gnu.org/licenses/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 //////////////////////////////////////////////////////////////////////// |
23424
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 #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
|
27 # include "config.h" |
872f42fb26dc
let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
28 #endif |
872f42fb26dc
let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
29 |
27725
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
30 #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
|
31 |
872f42fb26dc
let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
32 namespace octave |
872f42fb26dc
let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
33 { |
29863
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
34 void tree_walker::visit_anon_fcn_handle (tree_anon_fcn_handle& afh) |
27725
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
35 { |
29863
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
36 tree_parameter_list *parameter_list = afh.parameter_list (); |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
37 |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
38 if (parameter_list) |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
39 parameter_list->accept (*this); |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
40 |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
41 tree_expression *expression = afh.expression (); |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
42 |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
43 if (expression) |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
44 expression->accept (*this); |
27725
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 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
47 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
|
48 { |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
49 auto p = lst.begin (); |
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 while (p != lst.end ()) |
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 tree_expression *elt = *p++; |
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 if (elt) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
56 elt->accept (*this); |
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 } |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
59 |
29863
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
60 void tree_walker::visit_arguments_block (tree_arguments_block& blk) |
29724
c19f8cbe0fd5
initial implementation of parsing for arguments validaton block (bug #59405)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
61 { |
29863
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
62 tree_args_block_attribute_list *attribute_list = blk.attribute_list (); |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
63 |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
64 if (attribute_list) |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
65 attribute_list->accept (*this); |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
66 |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
67 tree_args_block_validation_list *validation_list = blk.validation_list (); |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
68 |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
69 if (validation_list) |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
70 validation_list->accept (*this); |
29724
c19f8cbe0fd5
initial implementation of parsing for arguments validaton block (bug #59405)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
71 } |
c19f8cbe0fd5
initial implementation of parsing for arguments validaton block (bug #59405)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
72 |
29863
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
73 void tree_walker::visit_args_block_attribute_list (tree_args_block_attribute_list& lst) |
29724
c19f8cbe0fd5
initial implementation of parsing for arguments validaton block (bug #59405)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
74 { |
29863
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
75 tree_identifier * attribute = lst.attribute (); |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
76 |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
77 if (attribute) |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
78 attribute->accept (*this); |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
79 } |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
80 |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
81 void tree_walker::visit_args_block_validation_list (tree_args_block_validation_list& lst) |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
82 { |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
83 for (auto *elt : lst) |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
84 { |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
85 if (elt) |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
86 elt->accept (*this); |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
87 } |
29724
c19f8cbe0fd5
initial implementation of parsing for arguments validaton block (bug #59405)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
88 } |
c19f8cbe0fd5
initial implementation of parsing for arguments validaton block (bug #59405)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
89 |
29863
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
90 void tree_walker::visit_arg_validation (tree_arg_validation& val) |
29724
c19f8cbe0fd5
initial implementation of parsing for arguments validaton block (bug #59405)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
91 { |
29863
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
92 tree_expression *arg_name = val.identifier_expression (); |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
93 |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
94 if (arg_name) |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
95 arg_name->accept (*this); |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
96 |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
97 tree_arg_size_spec *size_spec = val.size_spec (); |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
98 |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
99 if (size_spec) |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
100 size_spec->accept (*this); |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
101 |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
102 tree_identifier *class_name = val.class_name (); |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
103 |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
104 if (class_name) |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
105 class_name->accept (*this); |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
106 |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
107 tree_arg_validation_fcns *validation_fcns = val.validation_fcns (); |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
108 |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
109 if (validation_fcns) |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
110 validation_fcns->accept (*this); |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
111 |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
112 tree_expression *default_value = val.initializer_expression (); |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
113 |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
114 if (default_value) |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
115 default_value->accept (*this); |
29724
c19f8cbe0fd5
initial implementation of parsing for arguments validaton block (bug #59405)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
116 } |
c19f8cbe0fd5
initial implementation of parsing for arguments validaton block (bug #59405)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
117 |
29863
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
118 void tree_walker::visit_arg_size_spec (tree_arg_size_spec& spec) |
29724
c19f8cbe0fd5
initial implementation of parsing for arguments validaton block (bug #59405)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
119 { |
29863
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
120 tree_argument_list *size_args = spec.size_args (); |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
121 |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
122 if (size_args) |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
123 size_args->accept (*this); |
29724
c19f8cbe0fd5
initial implementation of parsing for arguments validaton block (bug #59405)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
124 } |
c19f8cbe0fd5
initial implementation of parsing for arguments validaton block (bug #59405)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
125 |
29863
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
126 void tree_walker::visit_arg_validation_fcns (tree_arg_validation_fcns& spec) |
29724
c19f8cbe0fd5
initial implementation of parsing for arguments validaton block (bug #59405)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
127 { |
29863
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
128 tree_argument_list *fcn_args = spec.fcn_args (); |
29724
c19f8cbe0fd5
initial implementation of parsing for arguments validaton block (bug #59405)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
129 |
29863
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
130 if (fcn_args) |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
131 fcn_args->accept (*this); |
29724
c19f8cbe0fd5
initial implementation of parsing for arguments validaton block (bug #59405)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
132 } |
c19f8cbe0fd5
initial implementation of parsing for arguments validaton block (bug #59405)
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
133 |
27725
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
134 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
|
135 { |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
136 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
|
137 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
138 if (op1) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
139 op1->accept (*this); |
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 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
|
142 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
143 if (op2) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
144 op2->accept (*this); |
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 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
147 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
|
148 { |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
149 visit_binary_expression (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 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
152 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
|
153 { |
872f42fb26dc
let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
154 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
|
155 } |
872f42fb26dc
let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
156 |
27725
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
157 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
|
158 { |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
159 // Nothing to do. |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
160 } |
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 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
|
163 { |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
164 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
|
165 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
166 if (op1) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
167 op1->accept (*this); |
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 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
|
170 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
171 if (op3) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
172 op3->accept (*this); |
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 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
|
175 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
176 if (op2) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
177 op2->accept (*this); |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
178 } |
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 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
|
181 { |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
182 // Nothing to do. |
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 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
185 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
|
186 { |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
187 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
|
188 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
189 if (init_list) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
190 init_list->accept (*this); |
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 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
193 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
|
194 { |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
195 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
|
196 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
197 if (id) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
198 id->accept (*this); |
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 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
|
201 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
202 if (expr) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
203 expr->accept (*this); |
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 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
206 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
|
207 { |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
208 // 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
|
209 // 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
|
210 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
211 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
|
212 { |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
213 if (elt) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
214 elt->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 } |
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_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
|
219 { |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
220 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
|
221 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
222 if (lhs) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
223 lhs->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 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
|
226 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
227 if (expr) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
228 expr->accept (*this); |
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 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
|
231 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
232 if (maxproc) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
233 maxproc->accept (*this); |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
234 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
235 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
|
236 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
237 if (list) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
238 list->accept (*this); |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
239 } |
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 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
|
242 { |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
243 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
|
244 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
245 if (lhs) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
246 lhs->accept (*this); |
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 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
|
249 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
250 if (expr) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
251 expr->accept (*this); |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
252 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
253 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
|
254 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
255 if (list) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
256 list->accept (*this); |
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 |
28518
b8ab8b58547d
accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
28317
diff
changeset
|
259 void tree_walker::visit_spmd_command (tree_spmd_command& cmd) |
b8ab8b58547d
accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
28317
diff
changeset
|
260 { |
b8ab8b58547d
accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
28317
diff
changeset
|
261 tree_statement_list *body = cmd.body (); |
b8ab8b58547d
accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
28317
diff
changeset
|
262 |
b8ab8b58547d
accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
28317
diff
changeset
|
263 if (body) |
b8ab8b58547d
accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
28317
diff
changeset
|
264 body->accept (*this); |
b8ab8b58547d
accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
28317
diff
changeset
|
265 } |
b8ab8b58547d
accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
28317
diff
changeset
|
266 |
27725
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
267 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
|
268 { |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
269 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
|
270 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
271 if (cmd_list) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
272 cmd_list->accept (*this); |
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 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
275 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
|
276 { |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
277 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
|
278 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
279 if (cmd_list) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
280 cmd_list->accept (*this); |
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 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
283 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
|
284 { |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
285 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
|
286 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
287 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
|
288 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
289 if (f) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
290 f->accept (*this); |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
291 } |
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 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
|
294 { |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
295 // Nothing to do. |
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_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
|
299 { |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
300 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
|
301 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
302 if (expr) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
303 expr->accept (*this); |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
304 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
305 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
|
306 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
307 if (list) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
308 list->accept (*this); |
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_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
|
312 { |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
313 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
|
314 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
315 if (list) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
316 list->accept (*this); |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
317 } |
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 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
|
320 { |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
321 auto p = lst.begin (); |
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 while (p != lst.end ()) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
324 { |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
325 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
|
326 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
327 if (elt) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
328 elt->accept (*this); |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
329 } |
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 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
332 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
|
333 { |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
334 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
|
335 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
336 if (label) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
337 label->accept (*this); |
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 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
|
340 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
341 if (list) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
342 list->accept (*this); |
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 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
345 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
|
346 { |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
347 auto p = lst.begin (); |
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 while (p != lst.end ()) |
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 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
|
352 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
353 if (elt) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
354 elt->accept (*this); |
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 } |
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 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
|
359 { |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
360 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
|
361 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
362 if (expr) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
363 expr->accept (*this); |
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 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
|
366 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
367 if (list) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
368 list->accept (*this); |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
369 } |
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 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
|
372 { |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
373 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
|
374 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
375 if (e) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
376 e->accept (*this); |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
377 |
28317
ac87763b1949
capture dynamic field variable values in anonymous functions (bug #58389)
John W. Eaton <jwe@octave.org>
parents:
28256
diff
changeset
|
378 std::list<tree_argument_list *> arg_lists = expr.arg_lists (); |
ac87763b1949
capture dynamic field variable values in anonymous functions (bug #58389)
John W. Eaton <jwe@octave.org>
parents:
28256
diff
changeset
|
379 std::list<string_vector> arg_names = expr.arg_names (); |
ac87763b1949
capture dynamic field variable values in anonymous functions (bug #58389)
John W. Eaton <jwe@octave.org>
parents:
28256
diff
changeset
|
380 std::list<tree_expression *> dyn_fields = expr.dyn_fields (); |
27725
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
381 |
28317
ac87763b1949
capture dynamic field variable values in anonymous functions (bug #58389)
John W. Eaton <jwe@octave.org>
parents:
28256
diff
changeset
|
382 auto p_arg_lists = arg_lists.begin (); |
ac87763b1949
capture dynamic field variable values in anonymous functions (bug #58389)
John W. Eaton <jwe@octave.org>
parents:
28256
diff
changeset
|
383 auto p_arg_names = arg_names.begin (); |
ac87763b1949
capture dynamic field variable values in anonymous functions (bug #58389)
John W. Eaton <jwe@octave.org>
parents:
28256
diff
changeset
|
384 auto p_dyn_fields = dyn_fields.begin (); |
ac87763b1949
capture dynamic field variable values in anonymous functions (bug #58389)
John W. Eaton <jwe@octave.org>
parents:
28256
diff
changeset
|
385 |
ac87763b1949
capture dynamic field variable values in anonymous functions (bug #58389)
John W. Eaton <jwe@octave.org>
parents:
28256
diff
changeset
|
386 std::string type_tags = expr.type_tags (); |
ac87763b1949
capture dynamic field variable values in anonymous functions (bug #58389)
John W. Eaton <jwe@octave.org>
parents:
28256
diff
changeset
|
387 int n = type_tags.length (); |
27725
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
388 |
28317
ac87763b1949
capture dynamic field variable values in anonymous functions (bug #58389)
John W. Eaton <jwe@octave.org>
parents:
28256
diff
changeset
|
389 for (int i = 0; i < n; i++) |
27725
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
390 { |
28317
ac87763b1949
capture dynamic field variable values in anonymous functions (bug #58389)
John W. Eaton <jwe@octave.org>
parents:
28256
diff
changeset
|
391 switch (type_tags[i]) |
ac87763b1949
capture dynamic field variable values in anonymous functions (bug #58389)
John W. Eaton <jwe@octave.org>
parents:
28256
diff
changeset
|
392 { |
ac87763b1949
capture dynamic field variable values in anonymous functions (bug #58389)
John W. Eaton <jwe@octave.org>
parents:
28256
diff
changeset
|
393 case '(': |
ac87763b1949
capture dynamic field variable values in anonymous functions (bug #58389)
John W. Eaton <jwe@octave.org>
parents:
28256
diff
changeset
|
394 case '{': |
ac87763b1949
capture dynamic field variable values in anonymous functions (bug #58389)
John W. Eaton <jwe@octave.org>
parents:
28256
diff
changeset
|
395 { |
ac87763b1949
capture dynamic field variable values in anonymous functions (bug #58389)
John W. Eaton <jwe@octave.org>
parents:
28256
diff
changeset
|
396 tree_argument_list *l = *p_arg_lists; |
ac87763b1949
capture dynamic field variable values in anonymous functions (bug #58389)
John W. Eaton <jwe@octave.org>
parents:
28256
diff
changeset
|
397 if (l) |
ac87763b1949
capture dynamic field variable values in anonymous functions (bug #58389)
John W. Eaton <jwe@octave.org>
parents:
28256
diff
changeset
|
398 l->accept (*this); |
ac87763b1949
capture dynamic field variable values in anonymous functions (bug #58389)
John W. Eaton <jwe@octave.org>
parents:
28256
diff
changeset
|
399 } |
ac87763b1949
capture dynamic field variable values in anonymous functions (bug #58389)
John W. Eaton <jwe@octave.org>
parents:
28256
diff
changeset
|
400 break; |
27725
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
401 |
28317
ac87763b1949
capture dynamic field variable values in anonymous functions (bug #58389)
John W. Eaton <jwe@octave.org>
parents:
28256
diff
changeset
|
402 case '.': |
ac87763b1949
capture dynamic field variable values in anonymous functions (bug #58389)
John W. Eaton <jwe@octave.org>
parents:
28256
diff
changeset
|
403 { |
ac87763b1949
capture dynamic field variable values in anonymous functions (bug #58389)
John W. Eaton <jwe@octave.org>
parents:
28256
diff
changeset
|
404 std::string fn = (*p_arg_names)(0); |
ac87763b1949
capture dynamic field variable values in anonymous functions (bug #58389)
John W. Eaton <jwe@octave.org>
parents:
28256
diff
changeset
|
405 if (fn.empty ()) |
ac87763b1949
capture dynamic field variable values in anonymous functions (bug #58389)
John W. Eaton <jwe@octave.org>
parents:
28256
diff
changeset
|
406 { |
ac87763b1949
capture dynamic field variable values in anonymous functions (bug #58389)
John W. Eaton <jwe@octave.org>
parents:
28256
diff
changeset
|
407 tree_expression *df = *p_dyn_fields; |
ac87763b1949
capture dynamic field variable values in anonymous functions (bug #58389)
John W. Eaton <jwe@octave.org>
parents:
28256
diff
changeset
|
408 if (df) |
ac87763b1949
capture dynamic field variable values in anonymous functions (bug #58389)
John W. Eaton <jwe@octave.org>
parents:
28256
diff
changeset
|
409 df->accept (*this); |
ac87763b1949
capture dynamic field variable values in anonymous functions (bug #58389)
John W. Eaton <jwe@octave.org>
parents:
28256
diff
changeset
|
410 } |
ac87763b1949
capture dynamic field variable values in anonymous functions (bug #58389)
John W. Eaton <jwe@octave.org>
parents:
28256
diff
changeset
|
411 } |
ac87763b1949
capture dynamic field variable values in anonymous functions (bug #58389)
John W. Eaton <jwe@octave.org>
parents:
28256
diff
changeset
|
412 break; |
ac87763b1949
capture dynamic field variable values in anonymous functions (bug #58389)
John W. Eaton <jwe@octave.org>
parents:
28256
diff
changeset
|
413 |
ac87763b1949
capture dynamic field variable values in anonymous functions (bug #58389)
John W. Eaton <jwe@octave.org>
parents:
28256
diff
changeset
|
414 default: |
ac87763b1949
capture dynamic field variable values in anonymous functions (bug #58389)
John W. Eaton <jwe@octave.org>
parents:
28256
diff
changeset
|
415 panic_impossible (); |
ac87763b1949
capture dynamic field variable values in anonymous functions (bug #58389)
John W. Eaton <jwe@octave.org>
parents:
28256
diff
changeset
|
416 } |
ac87763b1949
capture dynamic field variable values in anonymous functions (bug #58389)
John W. Eaton <jwe@octave.org>
parents:
28256
diff
changeset
|
417 |
ac87763b1949
capture dynamic field variable values in anonymous functions (bug #58389)
John W. Eaton <jwe@octave.org>
parents:
28256
diff
changeset
|
418 p_arg_lists++; |
ac87763b1949
capture dynamic field variable values in anonymous functions (bug #58389)
John W. Eaton <jwe@octave.org>
parents:
28256
diff
changeset
|
419 p_arg_names++; |
ac87763b1949
capture dynamic field variable values in anonymous functions (bug #58389)
John W. Eaton <jwe@octave.org>
parents:
28256
diff
changeset
|
420 p_dyn_fields++; |
27725
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 } |
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 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
|
425 { |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
426 auto p = lst.begin (); |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
427 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
428 while (p != lst.end ()) |
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 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
|
431 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
432 if (elt) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
433 elt->accept (*this); |
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 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
437 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
|
438 { |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
439 auto p = lst.begin (); |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
440 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
441 while (p != lst.end ()) |
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_argument_list *elt = *p++; |
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 (elt) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
446 elt->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 } |
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 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
|
451 { |
27725
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
452 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
|
453 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
454 if (lhs) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
455 lhs->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 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
|
458 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
459 if (rhs) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
460 rhs->accept (*this); |
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 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
463 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
|
464 { |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
465 // Nothing to do. |
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 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
468 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
|
469 { |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
470 // Nothing to do. |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
471 } |
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 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
|
474 { |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
475 // Nothing to do. |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
476 } |
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 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
|
479 { |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
480 auto p = lst.begin (); |
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 while (p != lst.end ()) |
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 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
|
485 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
486 if (elt) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
487 elt->accept (*this); |
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 } |
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 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
|
492 { |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
493 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
|
494 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
495 if (e) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
496 e->accept (*this); |
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 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
499 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
|
500 { |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
501 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
|
502 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
503 if (e) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
504 e->accept (*this); |
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_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
|
508 { |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
509 // Nothing to do. |
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_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
|
513 { |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
514 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
|
515 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
516 if (lhs) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
517 lhs->accept (*this); |
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 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
|
520 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
521 if (rhs) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
522 rhs->accept (*this); |
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 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
525 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
|
526 { |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
527 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
|
528 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
529 if (cmd) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
530 cmd->accept (*this); |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
531 else |
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 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
|
534 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
535 if (expr) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
536 expr->accept (*this); |
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 } |
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 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
|
541 { |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
542 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
|
543 { |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
544 if (elt) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
545 elt->accept (*this); |
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 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
549 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
|
550 { |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
551 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
|
552 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
553 if (try_code) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
554 try_code->accept (*this); |
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 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
|
557 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
558 if (expr_id) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
559 expr_id->accept (*this); |
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 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
|
562 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
563 if (catch_code) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
564 catch_code->accept (*this); |
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_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
|
568 { |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
569 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
|
570 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
571 if (unwind_protect_code) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
572 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
|
573 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
574 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
|
575 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
576 if (cleanup_code) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
577 cleanup_code->accept (*this); |
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 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
580 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
|
581 { |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
582 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
|
583 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
584 if (expr) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
585 expr->accept (*this); |
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 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
|
588 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
589 if (list) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
590 list->accept (*this); |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
591 } |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
592 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
593 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
|
594 { |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
595 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
|
596 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
597 if (list) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
598 list->accept (*this); |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
599 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
600 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
|
601 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
602 if (expr) |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
603 expr->accept (*this); |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
604 } |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
605 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
606 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
|
607 { |
29863
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
608 // Nothing to do. |
27725
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
609 } |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
610 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
611 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
|
612 { |
29863
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
613 // Nothing to do. |
27725
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
614 } |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
615 |
29863
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
616 void tree_walker::visit_classdef_attribute (tree_classdef_attribute& attr) |
27725
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
617 { |
29863
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
618 tree_identifier *id = attr.ident (); |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
619 |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
620 if (id) |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
621 id->accept (*this); |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
622 |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
623 tree_expression *expr = attr.expression (); |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
624 |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
625 if (expr) |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
626 expr->accept (*this); |
27725
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
627 } |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
628 |
29863
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
629 void tree_walker::visit_classdef_attribute_list (tree_classdef_attribute_list& lst) |
27725
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
630 { |
29863
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
631 for (auto *elt : lst) |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
632 { |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
633 if (elt) |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
634 elt->accept (*this); |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
635 } |
27725
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
636 } |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
637 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
638 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
|
639 { |
29863
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
640 // Nothing to do. |
27725
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
641 } |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
642 |
29863
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
643 void tree_walker::visit_classdef_superclass_list (tree_classdef_superclass_list& lst) |
27725
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
644 { |
29863
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
645 for (auto *elt : lst) |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
646 { |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
647 if (elt) |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
648 elt->accept (*this); |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
649 } |
27725
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
650 } |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
651 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
652 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
|
653 { |
29863
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
654 // FIXME: Should we operate on the tree_arg_validation object or the |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
655 // identifier and expression parts separately? |
27725
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
656 } |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
657 |
29863
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
658 void tree_walker::visit_classdef_property_list (tree_classdef_property_list& lst) |
27725
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
659 { |
29863
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
660 for (auto *elt : lst) |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
661 { |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
662 if (elt) |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
663 elt->accept (*this); |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
664 } |
27725
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
665 } |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
666 |
29863
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
667 void tree_walker::visit_classdef_properties_block (tree_classdef_properties_block& blk) |
27725
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
668 { |
29863
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
669 tree_classdef_property_list *property_list = blk.element_list (); |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
670 |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
671 if (property_list) |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
672 property_list->accept (*this); |
27725
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
673 } |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
674 |
29863
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
675 void tree_walker::visit_classdef_methods_list (tree_classdef_methods_list& lst) |
27725
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
676 { |
29863
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
677 for (auto ov_meth : lst) |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
678 { |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
679 octave_user_function *meth = ov_meth.user_function_value (); |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
680 |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
681 if (meth) |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
682 meth->accept (*this); |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
683 } |
27725
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
684 } |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
685 |
29863
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
686 void tree_walker::visit_classdef_methods_block (tree_classdef_methods_block& blk) |
27725
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
687 { |
29863
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
688 tree_classdef_methods_list *methods_list = blk.element_list (); |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
689 |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
690 if (methods_list) |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
691 methods_list->accept (*this); |
27725
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
692 } |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
693 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
694 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
|
695 { |
29863
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
696 // Nothing to do. |
27725
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
697 } |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
698 |
29863
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
699 void tree_walker::visit_classdef_events_list (tree_classdef_events_list& lst) |
27725
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
700 { |
29863
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
701 for (auto *elt : lst) |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
702 { |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
703 if (elt) |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
704 elt->accept (*this); |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
705 } |
27725
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
706 } |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
707 |
29863
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
708 void tree_walker::visit_classdef_events_block (tree_classdef_events_block& blk) |
27725
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
709 { |
29863
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
710 tree_classdef_events_list *events_list = blk.element_list (); |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
711 |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
712 if (events_list) |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
713 events_list->accept (*this); |
27725
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
714 } |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
715 |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
716 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
|
717 { |
29863
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
718 // Nothing to do. |
27725
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
719 } |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
720 |
29863
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
721 void tree_walker::visit_classdef_enum_list (tree_classdef_enum_list& lst) |
27725
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
722 { |
29863
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
723 for (auto *elt : lst) |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
724 { |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
725 if (elt) |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
726 elt->accept (*this); |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
727 } |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
728 } |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
729 |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
730 void tree_walker::visit_classdef_enum_block (tree_classdef_enum_block& blk) |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
731 { |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
732 tree_classdef_enum_list *enum_list = blk.element_list (); |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
733 |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
734 if (enum_list) |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
735 enum_list->accept (*this); |
27725
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
736 } |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
737 |
29863
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
738 void tree_walker::visit_classdef_body (tree_classdef_body& body) |
27725
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
739 { |
29863
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
740 for (auto *elt : body.properties_list ()) |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
741 { |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
742 if (elt) |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
743 elt->accept (*this); |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
744 } |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
745 |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
746 for (auto *elt : body.methods_list ()) |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
747 { |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
748 if (elt) |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
749 elt->accept (*this); |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
750 } |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
751 |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
752 |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
753 for (auto *elt : body.events_list ()) |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
754 { |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
755 if (elt) |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
756 elt->accept (*this); |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
757 } |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
758 |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
759 for (auto *elt : body.enum_list ()) |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
760 { |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
761 if (elt) |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
762 elt->accept (*this); |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
763 } |
27725
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
764 } |
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
765 |
29863
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
766 void tree_walker::visit_classdef (tree_classdef& cdef) |
27725
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
767 { |
29863
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
768 tree_classdef_attribute_list *attribute_list = cdef.attribute_list (); |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
769 |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
770 if (attribute_list) |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
771 attribute_list->accept (*this); |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
772 |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
773 tree_identifier *ident = cdef.ident (); |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
774 |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
775 if (ident) |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
776 ident->accept (*this); |
27725
6388a240de87
move some common actions into tree_walker base class
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
777 |
29863
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
778 tree_classdef_superclass_list *superclass_list = cdef.superclass_list (); |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
779 |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
780 if (superclass_list) |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
781 superclass_list->accept (*this); |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
782 |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
783 tree_classdef_body *body = cdef.body (); |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
784 |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
785 if (body) |
c29cfcf7a941
provide default definitions for more tree_walker methods
John W. Eaton <jwe@octave.org>
parents:
29724
diff
changeset
|
786 body->accept (*this); |
23424
872f42fb26dc
let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
787 } |
872f42fb26dc
let walker visit tree_boolean and tree_compound_binary expressions directly
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
788 } |