106 /* B 1.1 - Letters, digits and identifiers */ |
106 /* B 1.1 - Letters, digits and identifiers */ |
107 /*******************************************/ |
107 /*******************************************/ |
108 |
108 |
109 |
109 |
110 void *search_base_type_c::handle_datatype_identifier(token_c *type_name) { |
110 void *search_base_type_c::handle_datatype_identifier(token_c *type_name) { |
111 symbol_c *type_decl; |
|
112 |
|
113 this->current_basetype_name = type_name; |
111 this->current_basetype_name = type_name; |
114 /* if we have reached this point, it is because the current_basetype is not yet pointing to the base datatype we are looking for, |
112 /* if we have reached this point, it is because the current_basetype is not yet pointing to the base datatype we are looking for, |
115 * so we will be searching for the delcaration of the type named in type_name, which might be the base datatype (we search recursively!) |
113 * so we will be searching for the delcaration of the type named in type_name, which might be the base datatype (we search recursively!) |
116 */ |
114 */ |
117 this->current_basetype = NULL; |
115 this->current_basetype = NULL; |
118 |
116 |
119 /* look up the type declaration... */ |
117 /* look up the type declaration... */ |
120 type_decl = type_symtable.find_value(type_name); |
118 type_symtable_t::iterator iter1 = type_symtable.find(type_name); |
121 if (type_decl != type_symtable.end_value()) |
119 if (iter1 != type_symtable.end()) |
122 return type_decl->accept(*this); |
120 return iter1->second->accept(*this); // iter1->second is the type_decl |
123 |
121 |
124 type_decl = function_block_type_symtable.find_value(type_name); |
122 function_block_type_symtable_t::iterator iter2 = function_block_type_symtable.find(type_name); |
125 if (type_decl != function_block_type_symtable.end_value()) |
123 if (iter2 != function_block_type_symtable.end()) |
126 return type_decl->accept(*this); |
124 return iter2->second->accept(*this); // iter2->second is the type_decl |
127 |
125 |
128 /* Type declaration not found!! */ |
126 /* Type declaration not found!! */ |
129 ERROR; |
127 ERROR; |
130 |
128 |
131 return NULL; |
129 return NULL; |
132 } |
130 } |
133 |
131 |
134 void *search_base_type_c::visit( identifier_c *type_name) {return handle_datatype_identifier(type_name);} |
132 void *search_base_type_c::visit( identifier_c *type_name) {return handle_datatype_identifier(type_name);} |