vhdlpp: ScopeBase::is_enum_name checks enums from standard libraries.
This commit is contained in:
parent
cc9b182eb6
commit
e6b57910a4
|
|
@ -23,6 +23,7 @@
|
||||||
# include "subprogram.h"
|
# include "subprogram.h"
|
||||||
# include "entity.h"
|
# include "entity.h"
|
||||||
# include "std_funcs.h"
|
# include "std_funcs.h"
|
||||||
|
# include "std_types.h"
|
||||||
# include <algorithm>
|
# include <algorithm>
|
||||||
# include <iostream>
|
# include <iostream>
|
||||||
# include <iterator>
|
# include <iterator>
|
||||||
|
|
@ -197,7 +198,7 @@ const VTypeEnum* ScopeBase::is_enum_name(perm_string name) const
|
||||||
return *it;
|
return *it;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return find_std_enum_name(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,7 @@ void generate_global_types(ActiveScope*res)
|
||||||
VTypeEnum*enum_BOOLEAN = new VTypeEnum(enum_BOOLEAN_vals);
|
VTypeEnum*enum_BOOLEAN = new VTypeEnum(enum_BOOLEAN_vals);
|
||||||
type_BOOLEAN.set_definition(enum_BOOLEAN);
|
type_BOOLEAN.set_definition(enum_BOOLEAN);
|
||||||
std_types[type_BOOLEAN.peek_name()] = &type_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(type_BOOLEAN.peek_name(), &type_BOOLEAN);
|
||||||
res->use_name(perm_string::literal("bit"), &primitive_BIT);
|
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)
|
const VTypeEnum*find_std_enum_name(perm_string name)
|
||||||
{
|
{
|
||||||
for(list<const VTypeEnum*>::iterator it = std_enums.begin();
|
for(list<const VTypeEnum*>::const_iterator it = std_enums.begin();
|
||||||
it != std_enums.end(); ++it) {
|
it != std_enums.end(); ++it) {
|
||||||
if((*it)->has_name(name))
|
if((*it)->has_name(name))
|
||||||
return *it;
|
return *it;
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ int emit_packages(void);
|
||||||
void generate_global_types(ActiveScope*res);
|
void generate_global_types(ActiveScope*res);
|
||||||
bool is_global_type(perm_string type_name);
|
bool is_global_type(perm_string type_name);
|
||||||
void delete_global_types();
|
void delete_global_types();
|
||||||
|
const VTypeEnum*find_std_enum_name(perm_string name);
|
||||||
|
|
||||||
extern const VTypePrimitive primitive_BOOLEAN;
|
extern const VTypePrimitive primitive_BOOLEAN;
|
||||||
extern const VTypePrimitive primitive_BIT;
|
extern const VTypePrimitive primitive_BIT;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue