Diff of /cmajor++/Cm/Cm.Core/Callable.hpp [000000] .. [r302] Maximize Restore

  Switch to side-by-side view

--- a
+++ b/cmajor++/Cm/Cm.Core/Callable.hpp
@@ -0,0 +1,47 @@
+/*========================================================================
+    Copyright (c) 2012-2013 Seppo Laakko
+    http://sourceforge.net/projects/cmajor/
+ 
+    Distributed under the GNU General Public License, version 3 (GPLv3).
+    (See accompanying LICENSE.txt or http://www.gnu.org/licenses/gpl.html)
+
+ ========================================================================*/
+
+#ifndef CM_CORE_CALLABLE_INCLUDED
+#define CM_CORE_CALLABLE_INCLUDED
+#include <Cm.Core/Type.hpp>
+#include <Llvm.Ir/Parameter.hpp>
+
+namespace Cm { namespace Core {
+
+class Callable
+{
+public:
+    virtual ~Callable();
+    virtual TypePtr GetReturnType() const = 0;
+    virtual const ParameterList& GetParameters() const = 0;
+    virtual bool CanThrow() const = 0;
+    virtual void CreateIntermediateRepresentations();
+    bool ReturnsClassObjectByValue() const { return GetReturnType() && GetReturnType()->IsClassType(); }
+    Llvm::Ir::TypePtr GetIrReturnType() const { return irReturnType; }
+    const std::vector<Llvm::Ir::ParameterPtr>& GetIrParams() const { return irParameters; }
+    const std::vector<Llvm::Ir::TypePtr> GetIrParamTypes() const { return irParameterTypes; }
+    Llvm::Ir::ParameterPtr GetIrClassObjectParam() const { return irClassObjectPtrParam; }
+private:
+    Llvm::Ir::TypePtr irReturnType;
+    Llvm::Ir::ParameterPtr irClassObjectPtrParam;
+    std::vector<Llvm::Ir::ParameterPtr> irParameters;
+    std::vector<Llvm::Ir::TypePtr> irParameterTypes;
+};
+
+
+class CallableType: public Callable, public Type
+{
+public:
+    CallableType(const std::string& name_, const Position& pos_, const ScopePtr& enclosingScope_, const ScopePtr& fileScope_, int id_, int rank_);
+};
+
+} } // namespace Cm::Core
+
+#endif // CM_CORE_CALLABLE_INCLUDED
+