diff options
Diffstat (limited to 'src/include/ident.hpp')
-rw-r--r-- | src/include/ident.hpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/include/ident.hpp b/src/include/ident.hpp index 1122a68b..d702385c 100644 --- a/src/include/ident.hpp +++ b/src/include/ident.hpp @@ -14,9 +14,9 @@ struct Ident class Hygiene { static unsigned g_next_scope; - + ::std::vector<unsigned int> contexts; - + Hygiene(unsigned int index): contexts({index}) {} @@ -24,7 +24,7 @@ struct Ident Hygiene(): contexts({}) {} - + static Hygiene new_scope() { return Hygiene(++g_next_scope); @@ -37,23 +37,23 @@ struct Ident rv.contexts.push_back( ++g_next_scope ); return rv; } - + Hygiene(Hygiene&& x) = default; Hygiene(const Hygiene& x) = default; Hygiene& operator=(Hygiene&& x) = default; Hygiene& operator=(const Hygiene& x) = default; - + // Returns true if an ident with hygine `souce` can see an ident with this hygine bool is_visible(const Hygiene& source) const; //bool operator==(const Hygiene& x) const { return scope_index == x.scope_index; } //bool operator!=(const Hygiene& x) const { return scope_index != x.scope_index; } - + friend ::std::ostream& operator<<(::std::ostream& os, const Hygiene& v); }; - + Hygiene hygiene; ::std::string name; - + Ident(const char* name): hygiene(), name(name) @@ -65,20 +65,20 @@ struct Ident Ident(Hygiene hygiene, ::std::string name): hygiene(::std::move(hygiene)), name(::std::move(name)) { } - + Ident(Ident&& x) = default; Ident(const Ident& x) = default; Ident& operator=(Ident&& x) = default; Ident& operator=(const Ident& x) = default; - + ::std::string into_string() { return ::std::move(name); } - + bool operator==(const char* s) const { return this->name == s; } - + bool operator==(const Ident& x) const { if( this->name != x.name ) return false; @@ -90,6 +90,6 @@ struct Ident return !(*this == x); } bool operator<(const Ident& x) const; - + friend ::std::ostream& operator<<(::std::ostream& os, const Ident& x); }; |