abouttreesummaryrefslogcommitdiff
path: root/src/repr.h
diff options
context:
space:
mode:
authorPatrick Schönberger2021-08-11 23:34:11 +0200
committerPatrick Schönberger2021-08-11 23:34:11 +0200
commit9610ce88f0b753db81014a053bd3c6d79471c90c (patch)
treecfe08fa3543362bcb92473e23785efdf5666486c /src/repr.h
parent17860defa84c6d8bc0e8bc088a7e09361f17db07 (diff)
downloadtoc-9610ce88f0b753db81014a053bd3c6d79471c90c.tar.gz
toc-9610ce88f0b753db81014a053bd3c6d79471c90c.zip
add comments, fix struct/function lookup
Diffstat (limited to 'src/repr.h')
-rw-r--r--src/repr.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/repr.h b/src/repr.h
index 709528d..959e74d 100644
--- a/src/repr.h
+++ b/src/repr.h
@@ -44,6 +44,7 @@ struct Context
std::vector<Variable> variables;
std::vector<Function> functions;
std::vector<Struct> structs;
+ std::vector<Namespace> namespaces;
};
enum class TypeModifierType
@@ -65,6 +66,21 @@ struct Type
std::string name;
std::vector<TypeModifier> modifiers;
std::vector<Type> genericInstantiation;
+
+ bool operator!=(const Type & that)
+ {
+ if (this->name != that.name)
+ return true;
+
+ for (int i = 0; i < this->modifiers.size(); i++)
+ if (this->modifiers[i].type != that.modifiers[i].type)
+ return true;
+
+ for (int i = 0; i < this->namespacePrefixes.size(); i++)
+ if (this->namespacePrefixes[i] != that.namespacePrefixes[i])
+ return true;
+ return false;
+ }
};
struct Variable
@@ -113,13 +129,11 @@ struct Namespace
{
std::string name;
std::shared_ptr<Context> ctx;
- std::vector<Namespace> namespaces;
};
struct Program
{
std::shared_ptr<Context> ctx;
- std::vector<Namespace> namespaces;
};
enum class ExprType