summaryrefslogtreecommitdiff
path: root/src/include/ident.hpp
diff options
context:
space:
mode:
authorJohn Hodge (Mutabah) <acessdev@gmail.com>2016-12-25 17:19:27 +1100
committerGitHub <noreply@github.com>2016-12-25 17:19:27 +1100
commit753a2f44cc4c00b952cddae2ceed066ebb18a470 (patch)
treeed4bbff4be39c44c57164641f4ed32b5ad4675f0 /src/include/ident.hpp
parentd12a8a886caf2e0edf33c1af831b1df990d2c892 (diff)
parent0c14c734fa32014fd24297ccdbed927016185ffd (diff)
downloadmrust-753a2f44cc4c00b952cddae2ceed066ebb18a470.tar.gz
Merge pull request #11 from ubsan/whitespace-fix
No more tears!
Diffstat (limited to 'src/include/ident.hpp')
-rw-r--r--src/include/ident.hpp26
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);
};