- if (ctx->conditional() == nullptr && ctx->loop() == nullptr)\r
- o << ";";\r
-}\r
-void toc(std::ostream & o, TocParser::IfCondContext * ctx) {\r
- o << "if (";\r
- toc(o, ctx->expr());\r
- o << ")\n{\n";\r
- toc(o, ctx->body());\r
- o << "}\n";\r
-}\r
-void toc(std::ostream & o, TocParser::WhileLoopContext * ctx) {\r
- o << "while (";\r
- toc(o, ctx->expr());\r
- o << ")\n{\n";\r
- toc(o, ctx->body());\r
- o << "}\n";\r
-}\r
-void toc(std::ostream & o, TocParser::AssignmentContext * ctx) {\r
- toc(o, ctx->identifier());\r
- o << " = ";\r
- toc(o, ctx->expr());\r
-}\r
-void toc(std::ostream & o, TocParser::ReturnStmtContext * ctx) {\r
- o << "return ";\r
- toc(o, ctx->expr());\r
-}\r
-void toc(std::ostream & o, TocParser::ExprContext * ctx) {\r
- /**/ if (ctx->funcCall() != nullptr) toc(o, ctx->funcCall());\r
- else if (ctx->identifier() != nullptr) toc(o, ctx->identifier());\r
- else if (ctx->literal() != nullptr) toc(o, ctx->literal());\r
- else if (ctx->subscript() != nullptr) toc(o, ctx->subscript());\r
- else if (ctx->memberAccess() != nullptr) toc(o, ctx->memberAccess());\r
- else if (ctx->parenExpr() != nullptr) toc(o, ctx->parenExpr());\r
- else if (ctx->operatorExpr() != nullptr) toc(o, ctx->operatorExpr()->binaryOperator());\r
-}\r
-void toc(std::ostream & o, TocParser::NonOpExprContext * ctx) {\r
- /**/ if (ctx->funcCall() != nullptr) toc(o, ctx->funcCall());\r
- else if (ctx->identifier() != nullptr) toc(o, ctx->identifier());\r
- else if (ctx->literal() != nullptr) toc(o, ctx->literal());\r
- else if (ctx->subscript() != nullptr) toc(o, ctx->subscript());\r
- else if (ctx->memberAccess() != nullptr) toc(o, ctx->memberAccess());\r
- else if (ctx->parenExpr() != nullptr) toc(o, ctx->parenExpr());\r
-}\r
-void toc(std::ostream & o, TocParser::NonSubscriptExprContext * ctx) {\r
- /**/ if (ctx->funcCall() != nullptr) toc(o, ctx->funcCall());\r
- else if (ctx->identifier() != nullptr) toc(o, ctx->identifier());\r
- else if (ctx->memberAccess() != nullptr) toc(o, ctx->memberAccess());\r
- else if (ctx->parenExpr() != nullptr) toc(o, ctx->parenExpr());\r
-}\r
-void toc(std::ostream & o, TocParser::FuncCallContext * ctx) {\r
- o\r
- << ctx->funcName()->getText()\r
- << "(";\r
- for (int i = 0; i < ctx->expr().size(); i++) {\r
- if (i != 0) o << ", ";\r
- toc(o, ctx->expr(i));\r
+ indent(out, -2);\r
+ out << "};\n";\r
+ \r
+ for (auto m : s.methods)\r
+ {\r
+ Function f = m;\r
+ f.parameters.insert(f.parameters.begin(),\r
+ {"this",\r
+ {\r
+ namespaces,\r
+ s.name,\r
+ {\r
+ {TypeModifierType::Pointer, false, -1}\r
+ }\r
+ }\r
+ });\r
+ out << f.returnType << " " <<\r
+ namespacePrefix() << s.name << "_" << f.name <<\r
+ " (" << vectorStr(f.parameters, ", ") << ")\n" << f.body;\r