49 class search_varfb_instance_type_c: public search_base_type_c { |
49 class search_varfb_instance_type_c: public search_base_type_c { |
50 private: |
50 private: |
51 search_var_instance_decl_c search_var_instance_decl; |
51 search_var_instance_decl_c search_var_instance_decl; |
52 decompose_var_instance_name_c *decompose_var_instance_name; |
52 decompose_var_instance_name_c *decompose_var_instance_name; |
53 symbol_c *current_structelement_name; |
53 symbol_c *current_structelement_name; |
|
54 bool search_base_type; |
54 |
55 |
55 public: |
56 public: |
56 search_varfb_instance_type_c(symbol_c *search_scope): search_var_instance_decl(search_scope) { |
57 search_varfb_instance_type_c(symbol_c *search_scope): search_var_instance_decl(search_scope) { |
57 this->decompose_var_instance_name = NULL; |
58 this->decompose_var_instance_name = NULL; |
58 this->current_structelement_name = NULL; |
59 this->current_structelement_name = NULL; |
59 } |
60 this->search_base_type = false; |
60 |
61 } |
61 |
62 |
62 symbol_c *get_type(symbol_c *variable_name) { |
63 symbol_c *get_type(symbol_c *variable_name, bool base_type = true) { |
63 this->current_structelement_name = NULL; |
64 this->current_structelement_name = NULL; |
64 this->decompose_var_instance_name = new decompose_var_instance_name_c(variable_name); |
65 this->decompose_var_instance_name = new decompose_var_instance_name_c(variable_name); |
|
66 this->search_base_type = base_type; |
65 if (NULL == decompose_var_instance_name) ERROR; |
67 if (NULL == decompose_var_instance_name) ERROR; |
66 |
68 |
67 /* find the part of the variable name that will appear in the |
69 /* find the part of the variable name that will appear in the |
68 * variable declaration, for e.g., in window.point.x, this would be |
70 * variable declaration, for e.g., in window.point.x, this would be |
69 * window! |
71 * window! |
163 return fb_decl->accept(*this); |
165 return fb_decl->accept(*this); |
164 |
166 |
165 /* No. It is not a function block, so we let |
167 /* No. It is not a function block, so we let |
166 * the base class take care of it... |
168 * the base class take care of it... |
167 */ |
169 */ |
168 return search_base_type_c::visit(type_name); |
170 if (this->search_base_type) |
|
171 return search_base_type_c::visit(type_name); |
|
172 else |
|
173 return type_name; |
169 } |
174 } |
170 |
175 |
171 /********************************/ |
176 /********************************/ |
172 /* B 1.3.3 - Derived data types */ |
177 /* B 1.3.3 - Derived data types */ |
173 /********************************/ |
178 /********************************/ |
|
179 |
|
180 /* identifier ':' array_spec_init */ |
|
181 void *visit(array_type_declaration_c *symbol) { |
|
182 return symbol->array_spec_init->accept(*this); |
|
183 } |
|
184 |
|
185 /* array_specification [ASSIGN array_initialization} */ |
|
186 /* array_initialization may be NULL ! */ |
|
187 void *visit(array_spec_init_c *symbol) { |
|
188 return symbol->array_specification->accept(*this); |
|
189 } |
|
190 |
|
191 /* ARRAY '[' array_subrange_list ']' OF non_generic_type_name */ |
|
192 void *visit(array_specification_c *symbol) { |
|
193 return symbol->non_generic_type_name->accept(*this); |
|
194 } |
|
195 |
174 /* structure_type_name ':' structure_specification */ |
196 /* structure_type_name ':' structure_specification */ |
175 void *visit(structure_type_declaration_c *symbol) { |
197 void *visit(structure_type_declaration_c *symbol) { |
176 return symbol->structure_specification->accept(*this); |
198 return symbol->structure_specification->accept(*this); |
177 /* NOTE: structure_specification will point to either a |
199 /* NOTE: structure_specification will point to either a |
178 * initialized_structure_c |
200 * initialized_structure_c |