abouttreesummaryrefslogcommitdiff
path: root/src/toc.h
diff options
context:
space:
mode:
authorPatrick Schönberger2021-08-12 09:25:17 +0200
committerPatrick Schönberger2021-08-12 09:25:17 +0200
commite8e6aebbb892a72b287f1378901f855246da15a2 (patch)
treeee9add2cafa78f86ec1084f295f8b865ff399680 /src/toc.h
parent3b7b6d9a84bfc5f328c2ed78ca72a836a67468ae (diff)
downloadtoc-e8e6aebbb892a72b287f1378901f855246da15a2.tar.gz
toc-e8e6aebbb892a72b287f1378901f855246da15a2.zip
fixed NAME grammar rule
Diffstat (limited to 'src/toc.h')
-rw-r--r--src/toc.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/toc.h b/src/toc.h
index c58e2fc..e95ab3e 100644
--- a/src/toc.h
+++ b/src/toc.h
@@ -84,7 +84,7 @@ std::ostream & operator<< (std::ostream & out, const Type & t)
return out;
}
}
- TypeInfo ti = typeType(globalPrg, t);
+ TypeInfo ti = typeType(globalCtx, t);
if (ti.isStruct)
out << "struct ";
auto s = findStruct(t.name, t.namespacePrefixes, globalCtx);
@@ -178,13 +178,16 @@ std::ostream & operator<< (std::ostream & out, const Expr & e)
}
case ExprType::Method:
{
- TypeInfo ti = typeExpr(globalPrg, globalCtx, *e._method.expr);
+ TypeInfo ti = typeExpr(globalCtx, *e._method.expr);
out <<
vectorStr(ti.type.namespacePrefixes, "_", true) <<
ti.type.name << genericAppendix(ti.type.genericInstantiation) << "_" << e._method.methodName;
if (!e._method.genericInstantiation.empty())
out << genericAppendix(e._method.genericInstantiation);
- out << "(&" << *e._method.expr << (e._method.arguments.empty() ? "" : ", ") <<
+ out << "(";
+ if (e._method.expr->type == ExprType::Identifier)
+ out << "&";
+ out << *e._method.expr << (e._method.arguments.empty() ? "" : ", ") <<
vectorStr(e._method.arguments, ", ") << ")"; break;
}
case ExprType::Lit:
@@ -194,7 +197,7 @@ std::ostream & operator<< (std::ostream & out, const Expr & e)
else if (e._lit.type == LitType::Bool) out << e._lit._bool;
break;
case ExprType::Paren:
- out << "(" << e._paren.expr << ")"; break;
+ out << "(" << *e._paren.expr << ")"; break;
case ExprType::Dot:
out << *e._dot.expr << (e._dot.isPointer ? "->" : ".") << e._dot.identifier; break;
case ExprType::PrefixOp: