diff options
author | John Hodge <tpg@mutabah.net> | 2016-10-23 19:38:13 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-10-23 19:38:13 +0800 |
commit | ea3c657845313a274f99cc568ff4e3310e248e15 (patch) | |
tree | f8e381baa016bc499cb982bff6e8a2aebe392508 /src/hir/from_ast.cpp | |
parent | 061b63d4fd88e5802927bd42d4b0fd8d5f6fc0f8 (diff) | |
download | mrust-ea3c657845313a274f99cc568ff4e3310e248e15.tar.gz |
AST+HIR - Add stubbed support for erased types (`impl Trait`)
Diffstat (limited to 'src/hir/from_ast.cpp')
-rw-r--r-- | src/hir/from_ast.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/hir/from_ast.cpp b/src/hir/from_ast.cpp index cd8be320..bb40ece9 100644 --- a/src/hir/from_ast.cpp +++ b/src/hir/from_ast.cpp @@ -706,6 +706,7 @@ if( e.hrls.size() > 0 ) TODO(ty.span(), "TraitObjects with HRLS - " << ty); ::HIR::TypeRef::Data::Data_TraitObject v; + // TODO: Lifetime for(const auto& t : e.traits) { DEBUG("t = " << t); @@ -729,6 +730,24 @@ //ASSERT_BUG(ty.span(), v.m_trait.m_path.m_path != ::HIR::SimplePath(), "TraitObject type didn't contain a data trait - " << ty); return ::HIR::TypeRef( ::HIR::TypeRef::Data::make_TraitObject( mv$(v) ) ); ), + (ErasedType, + if( e.hrls.size() > 0 ) + TODO(ty.span(), "ErasedType with HRLS - " << ty); + ASSERT_BUG(ty.span(), e.traits.size() > 0, "ErasedType with no traits"); + + ::std::vector< ::HIR::TraitPath> traits; + for(const auto& t : e.traits) + { + DEBUG("t = " << t); + traits.push_back( LowerHIR_TraitPath(ty.span(), t) ); + } + // Leave `m_origin` until the bind pass + return ::HIR::TypeRef( ::HIR::TypeRef::Data::make_ErasedType(::HIR::TypeRef::Data::Data_ErasedType { + ::HIR::Path(::HIR::SimplePath()), + mv$(traits), + ::HIR::LifetimeRef() // TODO: Lifetime ref + } ) ); + ), (Function, ::std::vector< ::HIR::TypeRef> args; for(const auto& arg : e.info.m_arg_types) |