diff options
Diffstat (limited to 'src/hir/from_ast.cpp')
-rw-r--r-- | src/hir/from_ast.cpp | 31 |
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"; |