summaryrefslogtreecommitdiff
path: root/src/hir/path.hpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-05-23 22:16:29 +0800
committerJohn Hodge <tpg@mutabah.net>2016-05-23 22:16:29 +0800
commitb96c1a08cec9be6cc29f47eb151c3ad91075a819 (patch)
treefaf4259c8d8e59c7433a0dfca7313d0c7c686f5b /src/hir/path.hpp
parent1f9a4180a3b54f85f37919ba4ca709f8e8250bb6 (diff)
downloadmrust-b96c1a08cec9be6cc29f47eb151c3ad91075a819.tar.gz
HIR - Add type alias replacement. Other related changes below
- Added pretty printing for HIR paths and types - Added a sub-pass to resolve/index that makes all index paths point at the actual item (no imports involved) - Split up some contents of main_bindings.hpp
Diffstat (limited to 'src/hir/path.hpp')
-rw-r--r--src/hir/path.hpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/hir/path.hpp b/src/hir/path.hpp
index 9d66b135..acf24274 100644
--- a/src/hir/path.hpp
+++ b/src/hir/path.hpp
@@ -29,6 +29,7 @@ struct SimplePath
{
}
+ SimplePath clone() const;
SimplePath operator+(const ::std::string& s) const;
friend ::std::ostream& operator<<(::std::ostream& os, const SimplePath& x);
@@ -40,6 +41,7 @@ struct PathParams
::std::vector<TypeRef> m_types;
PathParams();
+ PathParams clone() const;
};
/// Generic path - Simple path with one lot of generic params
@@ -52,6 +54,10 @@ public:
GenericPath();
GenericPath(::HIR::SimplePath sp);
GenericPath(::HIR::SimplePath sp, ::HIR::PathParams params);
+
+ GenericPath clone() const;
+
+ friend ::std::ostream& operator<<(::std::ostream& os, const GenericPath& x);
};
class TraitPath
@@ -70,34 +76,35 @@ public:
TAGGED_UNION(Data, Generic,
(Generic, GenericPath),
(UfcsInherent, struct {
- TypeRefPtr type;
+ ::std::unique_ptr<TypeRef> type;
::std::string item;
PathParams params;
}),
(UfcsKnown, struct {
- TypeRefPtr type;
+ ::std::unique_ptr<TypeRef> type;
GenericPath trait;
::std::string item;
PathParams params;
}),
(UfcsUnknown, struct {
- TypeRefPtr type;
+ ::std::unique_ptr<TypeRef> type;
//GenericPath ??;
::std::string item;
PathParams params;
})
);
-private:
Data m_data;
-public:
Path(Data data):
m_data(mv$(data))
{}
Path(GenericPath _);
- Path(TypeRefPtr type, GenericPath trait, ::std::string item, PathParams params);
Path(SimplePath _);
+
+ Path clone() const;
+
+ friend ::std::ostream& operator<<(::std::ostream& os, const Path& x);
};
} // namespace HIR