Summary Files Commits Branches @commit @diff @stats
path: root / Year 2 / Implementation of Programming Languages / Transpiler / src / Value / Function / UserFunction.cpp
diff options
context:
space:
mode:
diff --git a/Year 2/Implementation of Programming Languages/Transpiler/src/Value/Function/UserFunction.cpp b/Year 2/Implementation of Programming Languages/Transpiler/src/Value/Function/UserFunction.cpp
new file mode 100644
index 0000000..a9841d3
--- /dev/null
+++ b/Year 2/Implementation of Programming Languages/Transpiler/src/Value/Function/UserFunction.cpp
@@ -0,0 +1,14 @@
+#include "UserFunction.h"
+#include "../../LLVMVisitor/LLVMVisitor.h"
+
+std::string UserFunction::Visit(LLVMVisitor& visitor) const {
+ return visitor.Visit(*this);
+}
+
+Value::T_Primitive UserFunction::RetType() const {
+ if (body.empty())
+ return T_void;
+ return body.back()->RetType();
+}
+
+UserFunction::UserFunction(std::string name, std::deque<Value*> args, std::deque<Function*> body) : Function(name, args), body(body) {}