Forbid redefenition of builtin types
This commit is contained in:
@ -51,11 +51,13 @@ namespace boot
|
||||
class declaration_visitor final : public empty_visitor, public error_container
|
||||
{
|
||||
type current_type;
|
||||
symbol_table symbols;
|
||||
|
||||
public:
|
||||
std::shared_ptr<symbol_table> symbols;
|
||||
std::unordered_map<std::string, std::shared_ptr<alias_type>> unresolved;
|
||||
|
||||
bool build_composite_type(const std::vector<field_declaration>& declarations,
|
||||
std::vector<type_field>& fields);
|
||||
|
||||
public:
|
||||
explicit declaration_visitor(const char *path, std::shared_ptr<symbol_table> symbols);
|
||||
|
||||
void visit(primitive_type_expression *type_expression) override;
|
||||
|
@ -85,7 +85,10 @@ namespace boot
|
||||
|
||||
struct alias_type
|
||||
{
|
||||
const std::string name;
|
||||
type reference;
|
||||
|
||||
explicit alias_type(const std::string& name);
|
||||
};
|
||||
|
||||
struct pointer_type
|
||||
@ -173,22 +176,30 @@ namespace boot
|
||||
|
||||
iterator begin()
|
||||
{
|
||||
return entries.begin();
|
||||
return this->entries.begin();
|
||||
}
|
||||
|
||||
iterator end()
|
||||
{
|
||||
return entries.end();
|
||||
return this->entries.end();
|
||||
}
|
||||
|
||||
const_iterator cbegin() const
|
||||
{
|
||||
return entries.cbegin();
|
||||
return this->entries.cbegin();
|
||||
}
|
||||
|
||||
const_iterator cend() const
|
||||
{
|
||||
return entries.cend();
|
||||
return this->entries.cend();
|
||||
}
|
||||
|
||||
/**
|
||||
* \return Symbol count in the current scope.
|
||||
*/
|
||||
std::size_t size() const
|
||||
{
|
||||
return this->entries.size();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -213,6 +224,15 @@ namespace boot
|
||||
return nothing;
|
||||
}
|
||||
|
||||
/**
|
||||
* \param name Symbol name.
|
||||
* \return Whether the table contains a symbol with the given name.
|
||||
*/
|
||||
bool contains(const std::string& name)
|
||||
{
|
||||
return lookup(name) != nothing;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers new symbol.
|
||||
*
|
||||
|
Reference in New Issue
Block a user