diff options
author | John Hodge <tpg@mutabah.net> | 2016-10-30 21:40:20 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-10-30 21:40:20 +0800 |
commit | 1d8bd9bf1c4ebe98e6bea954c939c97f0d7c3a93 (patch) | |
tree | 15d021b4919992606a270d913b115c34971da872 /src/ast/types.hpp | |
parent | 667912cb8de8cecd066505970d669565544eb431 (diff) | |
download | mrust-1d8bd9bf1c4ebe98e6bea954c939c97f0d7c3a93.tar.gz |
AST - Remove copy construction of TypeRef
Diffstat (limited to 'src/ast/types.hpp')
-rw-r--r-- | src/ast/types.hpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/ast/types.hpp b/src/ast/types.hpp index 66f5797c..04c1517f 100644 --- a/src/ast/types.hpp +++ b/src/ast/types.hpp @@ -110,16 +110,23 @@ class TypeRef public:
TypeData m_data;
- virtual ~TypeRef();
+ ~TypeRef();
- TypeRef(TypeRef&& other) noexcept = default;
+ TypeRef(TypeRef&& other) = default;
TypeRef& operator=(TypeRef&& other) = default;
- TypeRef(const TypeRef& other);
+ #if 1
+ TypeRef(const TypeRef& other) = delete;
+ TypeRef& operator=(const TypeRef& other) = delete;
+ #else
+ TypeRef(const TypeRef& other): m_span(other.m_span) {
+ *this = other.clone();
+ }
TypeRef& operator=(const TypeRef& other) {
- m_data = TypeRef(other).m_data;
+ m_data = mv$(other.clone().m_data);
return *this;
}
+ #endif
TypeRef(Span sp):
m_span( mv$(sp) ),
@@ -235,9 +242,7 @@ public: bool is_pointer() const { return m_data.is_Pointer(); }
bool is_tuple() const { return m_data.is_Tuple(); }
- TypeRef clone() const {
- return TypeRef(*this);
- }
+ TypeRef clone() const;
const TypeRef& inner_type() const {
TU_MATCH_DEF(TypeData, (m_data), (e),
|