瀏覽代碼

implementing casts

Nicolas Winkler 6 年之前
父節點
當前提交
195a2849b6
共有 2 個文件被更改,包括 47 次插入0 次删除
  1. 4 0
      src/Cast.cpp
  2. 43 0
      src/Cast.h

+ 4 - 0
src/Cast.cpp

@@ -0,0 +1,4 @@
+#include "Cast.h"
+
+
+

+ 43 - 0
src/Cast.h

@@ -0,0 +1,43 @@
+#ifndef QLOW_SEM_CAST_H
+#define QLOW_SEM_CAST_H
+
+#include <memory>
+
+namespace qlow
+{
+    namespace sem
+    {
+        // forward declaration
+        class Type;
+        
+        class Cast;
+    }
+}
+
+
+class qlow::sem::Cast
+{
+public:
+    std::shared_ptr<Type> from;
+    std::shared_ptr<Type> to;
+    
+    bool isExplicit;
+    
+    inline Cast(std::shared_ptr<Type> from, std::shared_ptr<Type> to) :
+        from{ std::move(from) },
+        to{ std::move(to) },
+        isExplicit{ true }
+    {
+    }
+    
+    inline Cast(std::shared_ptr<Type> from, std::shared_ptr<Type> to,
+                bool isExplicit) :
+        from{ std::move(from) },
+        to{ std::move(to) },
+        isExplicit{ isExplicit }
+    {
+    }
+};
+
+
+#endif // QLOW_SEM_CAST_H