summaryrefslogtreecommitdiff
path: root/src/hir/from_ast.cpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-05-20 16:33:05 +0800
committerJohn Hodge <tpg@mutabah.net>2016-05-20 16:33:05 +0800
commit4ef6649aa789d8f57c62d0e848233967abde959d (patch)
tree8de30e63407a10a5b46885ffde3de9a7bc6da18a /src/hir/from_ast.cpp
parentcbb7c1b5c7e3539340a6e4f04d521b2f9564b526 (diff)
downloadmrust-4ef6649aa789d8f57c62d0e848233967abde959d.tar.gz
HIR - Separate UFCS styles
Diffstat (limited to 'src/hir/from_ast.cpp')
-rw-r--r--src/hir/from_ast.cpp31
1 files changed, 25 insertions, 6 deletions
diff --git a/src/hir/from_ast.cpp b/src/hir/from_ast.cpp
index 4752d000..827ac973 100644
--- a/src/hir/from_ast.cpp
+++ b/src/hir/from_ast.cpp
@@ -394,12 +394,31 @@
(UFCS,
if( e.nodes.size() != 1 )
throw "TODO: Handle UFCS with multiple nodes";
- return ::HIR::Path(
- LowerHIR_Type(*e.type),
- LowerHIR_GenericPath(*e.trait),
- e.nodes[0].name(),
- {}
- );
+ if( ! e.trait )
+ {
+ return ::HIR::Path(::HIR::Path::Data::make_UfcsInherent({
+ LowerHIR_Type(*e.type),
+ e.nodes[0].name(),
+ {}
+ }));
+ }
+ else if( ! e.trait->is_valid() )
+ {
+ return ::HIR::Path(::HIR::Path::Data::make_UfcsUnknown({
+ LowerHIR_Type(*e.type),
+ e.nodes[0].name(),
+ {}
+ }));
+ }
+ else
+ {
+ return ::HIR::Path(
+ LowerHIR_Type(*e.type),
+ LowerHIR_GenericPath(*e.trait),
+ e.nodes[0].name(),
+ {}
+ );
+ }
)
)
throw "BUGCHECK: Reached end of LowerHIR_Path";