]> gitweb.ps.run Git - toc/blobdiff - src/toc.h
fixed NAME grammar rule
[toc] / src / toc.h
index c58e2fc0ccd5853b5bda45046711e15ed816ae92..e95ab3eca27872b427846614e33c7ba0fd2d93e5 100644 (file)
--- a/src/toc.h
+++ b/src/toc.h
@@ -84,7 +84,7 @@ std::ostream & operator<< (std::ostream & out, const Type & t)
       return out;\r
     }\r
   }\r
-  TypeInfo ti = typeType(globalPrg, t);\r
+  TypeInfo ti = typeType(globalCtx, t);\r
   if (ti.isStruct)\r
     out << "struct ";\r
   auto s = findStruct(t.name, t.namespacePrefixes, globalCtx);\r
@@ -178,13 +178,16 @@ std::ostream & operator<< (std::ostream & out, const Expr & e)
   }\r
   case ExprType::Method:\r
   {\r
-    TypeInfo ti = typeExpr(globalPrg, globalCtx, *e._method.expr);\r
+    TypeInfo ti = typeExpr(globalCtx, *e._method.expr);\r
     out <<\r
       vectorStr(ti.type.namespacePrefixes, "_", true) <<\r
       ti.type.name << genericAppendix(ti.type.genericInstantiation) << "_" << e._method.methodName;\r
     if (!e._method.genericInstantiation.empty())\r
       out << genericAppendix(e._method.genericInstantiation);\r
-    out << "(&" << *e._method.expr << (e._method.arguments.empty() ? "" : ", ") <<\r
+    out << "(";\r
+    if (e._method.expr->type == ExprType::Identifier)\r
+      out << "&";\r
+    out << *e._method.expr << (e._method.arguments.empty() ? "" : ", ") <<\r
     vectorStr(e._method.arguments, ", ") << ")"; break;\r
   }\r
   case ExprType::Lit:\r
@@ -194,7 +197,7 @@ std::ostream & operator<< (std::ostream & out, const Expr & e)
     else if (e._lit.type == LitType::Bool) out << e._lit._bool;\r
     break;\r
   case ExprType::Paren:\r
-    out << "(" << e._paren.expr << ")"; break;\r
+    out << "(" << *e._paren.expr << ")"; break;\r
   case ExprType::Dot:\r
     out << *e._dot.expr << (e._dot.isPointer ? "->" : ".") << e._dot.identifier; break;\r
   case ExprType::PrefixOp:\r