abouttreesummaryrefslogcommitdiff
path: root/src
diff options
context:
space:
mode:
authorPatrick Schönberger2021-08-14 14:56:12 +0200
committerPatrick Schönberger2021-08-14 14:56:12 +0200
commitc6ad2948bb98d42f8e0883ef82cd14cd2d5eda60 (patch)
tree9e83d6d8f61e56f5d3425b8709314d6bdb9315a9 /src
parent9f94b672a5dc32da5ad01742bd4e976315a30d9c (diff)
downloadtoc-main.tar.gz
toc-main.zip
add antlr source code and ReadMeHEADmain
Diffstat (limited to 'src')
-rw-r--r--src/toc.h4
-rw-r--r--src/visit.h20
2 files changed, 13 insertions, 11 deletions
diff --git a/src/toc.h b/src/toc.h
index 254abf2..c31e12b 100644
--- a/src/toc.h
+++ b/src/toc.h
@@ -305,7 +305,9 @@ void tocFunction (std::ostream & out, const Function & f, bool stub)
currentInstantiation[f.genericTypeNames[i]] = instantiation[i];
}
- out << f.returnType << " " << generateModifiers(namespacePrefix() + f.name, f.returnType.modifiers) << genericAppendix(instantiation) << " (" << vectorStr(f.parameters, ", ") << ")";
+ out << f.returnType << " " <<
+ generateModifiers(namespacePrefix() + f.name + genericAppendix(instantiation), f.returnType.modifiers) <<
+ " (" << vectorStr(f.parameters, ", ") << ")";
if (stub)
{
diff --git a/src/visit.h b/src/visit.h
index 646ac61..279a4fc 100644
--- a/src/visit.h
+++ b/src/visit.h
@@ -8,17 +8,17 @@
// tree can be walked selectively by providing only
// needed callbacks
struct Visitor {
- std::function<void(const Type &, const std::shared_ptr<Context> ctx)> onType = [](auto, auto){};
- std::function<void(const Expr &, const std::shared_ptr<Context> ctx)> onExpr = [](auto, auto){};
- std::function<void(const Stmt &, const std::shared_ptr<Context> ctx)> onStmt = [](auto, auto){};
- std::function<void(const Body &, const std::shared_ptr<Context> ctx)> onBody = [](auto, auto){};
- std::function<void(const Function &, const std::shared_ptr<Context> ctx)> onFunction = [](auto, auto){};
- std::function<void(const Variable &, const std::shared_ptr<Context> ctx)> onVariable = [](auto, auto){};
+ std::function<void(const Type &, const std::shared_ptr<Context> ctx)> onType = [](auto, auto){};
+ std::function<void(const Expr &, const std::shared_ptr<Context> ctx)> onExpr = [](auto, auto){};
+ std::function<void(const Stmt &, const std::shared_ptr<Context> ctx)> onStmt = [](auto, auto){};
+ std::function<void(const Body &, const std::shared_ptr<Context> ctx)> onBody = [](auto, auto){};
+ std::function<void(const Function &, const std::shared_ptr<Context> ctx)> onFunction = [](auto, auto){};
+ std::function<void(const Variable &, const std::shared_ptr<Context> ctx)> onVariable = [](auto, auto){};
std::function<void(const StructMember<Function> &, const std::shared_ptr<Context> ctx)> onStructMethod = [](auto, auto){};
std::function<void(const StructMember<Variable> &, const std::shared_ptr<Context> ctx)> onStructMember = [](auto, auto){};
- std::function<void(const Struct &, const std::shared_ptr<Context> ctx)> onStruct = [](auto, auto){};
- std::function<void(const Namespace &, const std::shared_ptr<Context> ctx)> onNamespace = [](auto, auto){};
- std::function<void(const Program &, const std::shared_ptr<Context> ctx)> onProgram = [](auto, auto){};
+ std::function<void(const Struct &, const std::shared_ptr<Context> ctx)> onStruct = [](auto, auto){};
+ std::function<void(const Namespace &, const std::shared_ptr<Context> ctx)> onNamespace = [](auto, auto){};
+ std::function<void(const Program &, const std::shared_ptr<Context> ctx)> onProgram = [](auto, auto){};
};
#define VISIT(XS) for (auto x : XS) visit(x);
@@ -162,9 +162,9 @@ public:
v.onFunction(x, ctx);
if (x.defined) {
- visit(x.body);
for (auto v : x.parameters)
visit(v.type);
+ visit(x.body);
}
}
void visit(const StructMember<Function> & x)