diff options
| author | John Hodge <tpg@ucc.asn.au> | 2017-05-13 13:43:00 +0800 | 
|---|---|---|
| committer | John Hodge <tpg@ucc.asn.au> | 2017-05-13 13:43:20 +0800 | 
| commit | e7f840ec5ae243a6d050a692fd6633769fc147a5 (patch) | |
| tree | e0656b60f3663c0db9aefb3135533d17960c930e /src | |
| parent | a25a8fa64b36cb43bc4b0a3054f51c65ceaf6b61 (diff) | |
| download | mrust-e7f840ec5ae243a6d050a692fd6633769fc147a5.tar.gz | |
Trans Codegen - Fill item path when monomorphising
Diffstat (limited to 'src')
| -rw-r--r-- | src/hir/item_path.hpp | 3 | ||||
| -rw-r--r-- | src/trans/codegen.cpp | 10 | 
2 files changed, 8 insertions, 5 deletions
| diff --git a/src/hir/item_path.hpp b/src/hir/item_path.hpp index f0c591af..9f9949e1 100644 --- a/src/hir/item_path.hpp +++ b/src/hir/item_path.hpp @@ -110,7 +110,8 @@ public:          else if( x.trait ) {              os << "<* as " << *x.trait << ">";          } -        else { +        else if( x.crate_name ) { +            os << "\"" << x.crate_name << "\"";          }          return os;      } diff --git a/src/trans/codegen.cpp b/src/trans/codegen.cpp index 9d536181..7989981b 100644 --- a/src/trans/codegen.cpp +++ b/src/trans/codegen.cpp @@ -158,10 +158,12 @@ void Trans_Codegen(const ::std::string& outfile, const TransOptions& opt, const                  for(const auto& a : fcn.m_args)                      args.push_back(::std::make_pair( ::HIR::Pattern{}, pp.monomorph(resolve, a.second) ));                  auto mir = Trans_Monomorphise(resolve, pp, fcn.m_code.m_mir); -                MIR_Validate(resolve, ::HIR::ItemPath(""), *mir, args, ret_type); -                MIR_Cleanup(resolve, ::HIR::ItemPath(""), *mir, args, ret_type); -                MIR_Optimise(resolve, ::HIR::ItemPath(""), *mir, args, ret_type); -                MIR_Validate(resolve, ::HIR::ItemPath(""), *mir, args, ret_type); +                ::std::string s = FMT(path); +                ::HIR::ItemPath ip(s); +                MIR_Validate(resolve, ip, *mir, args, ret_type); +                MIR_Cleanup(resolve, ip, *mir, args, ret_type); +                MIR_Optimise(resolve, ip, *mir, args, ret_type); +                MIR_Validate(resolve, ip, *mir, args, ret_type);                  codegen->emit_function_code(path, fcn, ent.second->pp,  mir);              }              // TODO: Detect if the function was a #[inline] function from another crate, and don't emit if that is the case? | 
