diff --git a/vhdlpp/scope.cc b/vhdlpp/scope.cc index 3a7fdc4d7..cb20fb9f8 100644 --- a/vhdlpp/scope.cc +++ b/vhdlpp/scope.cc @@ -23,6 +23,7 @@ # include "subprogram.h" # include "entity.h" # include "std_funcs.h" +# include "std_types.h" # include # include # include @@ -197,7 +198,7 @@ const VTypeEnum* ScopeBase::is_enum_name(perm_string name) const return *it; } - return NULL; + return find_std_enum_name(name); } /* diff --git a/vhdlpp/std_types.cc b/vhdlpp/std_types.cc index 9085741ff..20acb42a6 100644 --- a/vhdlpp/std_types.cc +++ b/vhdlpp/std_types.cc @@ -51,6 +51,7 @@ void generate_global_types(ActiveScope*res) VTypeEnum*enum_BOOLEAN = new VTypeEnum(enum_BOOLEAN_vals); type_BOOLEAN.set_definition(enum_BOOLEAN); std_types[type_BOOLEAN.peek_name()] = &type_BOOLEAN; + std_enums.push_back(enum_BOOLEAN); res->use_name(type_BOOLEAN.peek_name(), &type_BOOLEAN); res->use_name(perm_string::literal("bit"), &primitive_BIT); @@ -76,7 +77,7 @@ void delete_global_types() const VTypeEnum*find_std_enum_name(perm_string name) { - for(list::iterator it = std_enums.begin(); + for(list::const_iterator it = std_enums.begin(); it != std_enums.end(); ++it) { if((*it)->has_name(name)) return *it; diff --git a/vhdlpp/std_types.h b/vhdlpp/std_types.h index 6715a4358..b38003cf4 100644 --- a/vhdlpp/std_types.h +++ b/vhdlpp/std_types.h @@ -27,6 +27,7 @@ int emit_packages(void); void generate_global_types(ActiveScope*res); bool is_global_type(perm_string type_name); void delete_global_types(); +const VTypeEnum*find_std_enum_name(perm_string name); extern const VTypePrimitive primitive_BOOLEAN; extern const VTypePrimitive primitive_BIT;