]> gitweb.ps.run Git - toc/blobdiff - src/repr.h
add comments, fix struct/function lookup
[toc] / src / repr.h
index 709528d3c8b55986ea65e73c164ff69f27d95855..959e74dfe891873eecfcdbf2671d003497f8bb95 100644 (file)
@@ -44,6 +44,7 @@ struct Context
   std::vector<Variable> variables;\r
   std::vector<Function> functions;\r
   std::vector<Struct> structs;\r
+  std::vector<Namespace> namespaces;\r
 };\r
 \r
 enum class TypeModifierType\r
@@ -65,6 +66,21 @@ struct Type
   std::string name;\r
   std::vector<TypeModifier> modifiers;\r
   std::vector<Type> genericInstantiation;\r
+  \r
+  bool operator!=(const Type & that)\r
+  {\r
+    if (this->name != that.name)\r
+      return true;\r
+\r
+    for (int i = 0; i < this->modifiers.size(); i++)\r
+      if (this->modifiers[i].type != that.modifiers[i].type)\r
+        return true;\r
+\r
+    for (int i = 0; i < this->namespacePrefixes.size(); i++)\r
+      if (this->namespacePrefixes[i] != that.namespacePrefixes[i])\r
+        return true;\r
+    return false;\r
+  }\r
 };\r
 \r
 struct Variable\r
@@ -113,13 +129,11 @@ struct Namespace
 {\r
   std::string name;\r
   std::shared_ptr<Context> ctx;\r
-  std::vector<Namespace> namespaces;\r
 };\r
 \r
 struct Program\r
 {\r
   std::shared_ptr<Context> ctx;\r
-  std::vector<Namespace> namespaces;\r
 };\r
 \r
 enum class ExprType\r