diff options
author | John Hodge <tpg@mutabah.net> | 2016-11-02 22:56:19 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-11-02 22:56:19 +0800 |
commit | dc69b7313160536c4a361a4474ec361ec3b1e55b (patch) | |
tree | de593eda4fb273edc1cd18d063109fa3461d4559 /src/ident.cpp | |
parent | e31eef7a4a00d46ce184dd33aea4d8c07b7ffb39 (diff) | |
download | mrust-dc69b7313160536c4a361a4474ec361ec3b1e55b.tar.gz |
Hygiene - Possibly working
Diffstat (limited to 'src/ident.cpp')
-rw-r--r-- | src/ident.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/ident.cpp b/src/ident.cpp index 8543d6fa..45c96f2e 100644 --- a/src/ident.cpp +++ b/src/ident.cpp @@ -15,8 +15,17 @@ unsigned int Ident::Hygiene::g_next_scope = 0; bool Ident::Hygiene::is_visible(const Hygiene& src) const { // HACK: Disable hygiene for now - return true; - //return this->scope_index == src.scope_index; + //return true; + + if( this->contexts.size() == 0 ) { + return src.contexts.size() == 0; + } + + auto des = this->contexts.back(); + for(const auto& c : src.contexts) + if( des == c ) + return true; + return false; } ::std::ostream& operator<<(::std::ostream& os, const Ident& x) { @@ -25,7 +34,7 @@ bool Ident::Hygiene::is_visible(const Hygiene& src) const } ::std::ostream& operator<<(::std::ostream& os, const Ident::Hygiene& x) { - os << "{" << x.scope_index << "}"; + os << "{" << x.contexts << "}"; return os; } |