115 } |
115 } |
116 |
116 |
117 |
117 |
118 void *type_initial_value_c::handle_type_name(symbol_c *type_name) { |
118 void *type_initial_value_c::handle_type_name(symbol_c *type_name) { |
119 /* look up the type declaration... */ |
119 /* look up the type declaration... */ |
120 symbol_c *type_decl = type_symtable.find_value(type_name); |
120 type_symtable_t::iterator iter = type_symtable.find(type_name); |
121 /* Type declaration not found!! */ |
121 /* Type declaration not found!! */ |
122 /* NOTE: Variables declared out of function block 'data types',for eg: VAR timer: TON; END_VAR |
122 /* NOTE: Variables declared out of function block 'data types',for eg: VAR timer: TON; END_VAR |
123 * do not have a default value, so (TON) will never be found in the type symbol table. This means |
123 * do not have a default value, so (TON) will never be found in the type symbol table. This means |
124 * we cannot simply consider this an error and abort, but must rather return a NULL. |
124 * we cannot simply consider this an error and abort, but must rather return a NULL. |
125 */ |
125 */ |
126 if (type_decl == type_symtable.end_value()) return NULL; |
126 if (iter == type_symtable.end()) return NULL; |
127 |
127 |
128 return type_decl->accept(*this); |
128 return iter->second->accept(*this); // iter->second is the type_decl |
129 } |
129 } |
130 |
130 |
131 /* visitor for identifier_c should no longer be necessary. All references to derived datatypes are now stored in then */ |
131 /* visitor for identifier_c should no longer be necessary. All references to derived datatypes are now stored in then */ |
132 /* AST using either poutype_identifier_c or derived_datatype_identifier_c. In principe, the following should not be necesasry */ |
132 /* AST using either poutype_identifier_c or derived_datatype_identifier_c. In principe, the following should not be necesasry */ |
133 void *type_initial_value_c::visit( identifier_c *symbol) {return handle_type_name(symbol);} /* should never occur */ |
133 void *type_initial_value_c::visit( identifier_c *symbol) {return handle_type_name(symbol);} /* should never occur */ |