Mercurial > octave-nkf
comparison src/pt-decl.h @ 7336:745a8299c2b5
[project @ 2007-12-28 20:56:55 by jwe]
author | jwe |
---|---|
date | Fri, 28 Dec 2007 20:56:58 +0000 |
parents | a1dbe9d80eee |
children | 71f068b22fcc |
comparison
equal
deleted
inserted
replaced
7335:58f5fab3ebe5 | 7336:745a8299c2b5 |
---|---|
33 | 33 |
34 #include "base-list.h" | 34 #include "base-list.h" |
35 #include "oct-lvalue.h" | 35 #include "oct-lvalue.h" |
36 #include "pt-cmd.h" | 36 #include "pt-cmd.h" |
37 #include "pt-id.h" | 37 #include "pt-id.h" |
38 #include "symtab.h" | |
38 | 39 |
39 // List of expressions that make up a declaration statement. | 40 // List of expressions that make up a declaration statement. |
40 | 41 |
41 class | 42 class |
42 tree_decl_elt | 43 tree_decl_elt |
51 ~tree_decl_elt (void); | 52 ~tree_decl_elt (void); |
52 | 53 |
53 bool eval (void); | 54 bool eval (void); |
54 | 55 |
55 bool is_defined (void) { return id ? id->is_defined () : false; } | 56 bool is_defined (void) { return id ? id->is_defined () : false; } |
57 | |
58 bool is_variable (void) { return id ? id->is_variable () : false; } | |
56 | 59 |
57 void mark_as_formal_parameter (void) | 60 void mark_as_formal_parameter (void) |
58 { | 61 { |
59 if (id) | 62 if (id) |
60 id->mark_as_formal_parameter (); | 63 id->mark_as_formal_parameter (); |
73 | 76 |
74 tree_identifier *ident (void) { return id; } | 77 tree_identifier *ident (void) { return id; } |
75 | 78 |
76 tree_expression *expression (void) { return expr; } | 79 tree_expression *expression (void) { return expr; } |
77 | 80 |
78 tree_decl_elt *dup (symbol_table *sym_tab); | 81 tree_decl_elt *dup (symbol_table::scope_id scope); |
79 | 82 |
80 void accept (tree_walker& tw); | 83 void accept (tree_walker& tw); |
81 | 84 |
82 private: | 85 private: |
83 | 86 |
113 } | 116 } |
114 } | 117 } |
115 | 118 |
116 void eval (tree_decl_elt::eval_fcn); | 119 void eval (tree_decl_elt::eval_fcn); |
117 | 120 |
118 tree_decl_init_list *dup (symbol_table *sym_tab); | 121 tree_decl_init_list *dup (symbol_table::scope_id scope); |
119 | 122 |
120 void accept (tree_walker& tw); | 123 void accept (tree_walker& tw); |
121 | 124 |
122 private: | 125 private: |
123 | 126 |
134 tree_decl_command : public tree_command | 137 tree_decl_command : public tree_command |
135 { | 138 { |
136 public: | 139 public: |
137 | 140 |
138 tree_decl_command (const std::string& n, int l = -1, int c = -1) | 141 tree_decl_command (const std::string& n, int l = -1, int c = -1) |
139 : tree_command (l, c), cmd_name (n), initialized (false), init_list (0) { } | 142 : tree_command (l, c), cmd_name (n), init_list (0) { } |
140 | 143 |
141 tree_decl_command (const std::string& n, tree_decl_init_list *t, | 144 tree_decl_command (const std::string& n, tree_decl_init_list *t, |
142 int l = -1, int c = -1) | 145 int l = -1, int c = -1) |
143 : tree_command (l, c), cmd_name (n), initialized (false), init_list (t) { } | 146 : tree_command (l, c), cmd_name (n), init_list (t) { } |
144 | 147 |
145 ~tree_decl_command (void); | 148 ~tree_decl_command (void); |
146 | 149 |
147 tree_decl_init_list *initializer_list (void) { return init_list; } | 150 tree_decl_init_list *initializer_list (void) { return init_list; } |
148 | 151 |
153 protected: | 156 protected: |
154 | 157 |
155 // The name of this command -- global, static, etc. | 158 // The name of this command -- global, static, etc. |
156 std::string cmd_name; | 159 std::string cmd_name; |
157 | 160 |
158 // TRUE if this command has been evaluated. | |
159 bool initialized; | |
160 | |
161 // The list of variables or initializers in this declaration command. | 161 // The list of variables or initializers in this declaration command. |
162 tree_decl_init_list *init_list; | 162 tree_decl_init_list *init_list; |
163 | 163 |
164 private: | 164 private: |
165 | 165 |
185 | 185 |
186 ~tree_global_command (void) { } | 186 ~tree_global_command (void) { } |
187 | 187 |
188 void eval (void); | 188 void eval (void); |
189 | 189 |
190 tree_command *dup (symbol_table *sym_tab); | 190 tree_command *dup (symbol_table::scope_id scope); |
191 | 191 |
192 private: | 192 private: |
193 | 193 |
194 static void do_init (tree_decl_elt& elt); | 194 static void do_init (tree_decl_elt& elt); |
195 | 195 |
215 | 215 |
216 ~tree_static_command (void) { } | 216 ~tree_static_command (void) { } |
217 | 217 |
218 void eval (void); | 218 void eval (void); |
219 | 219 |
220 tree_command *dup (symbol_table *sym_tab); | 220 tree_command *dup (symbol_table::scope_id scope); |
221 | 221 |
222 private: | 222 private: |
223 | 223 |
224 static void do_init (tree_decl_elt& elt); | 224 static void do_init (tree_decl_elt& elt); |
225 | 225 |