diff options
author | John Hodge <tpg@mutabah.net> | 2015-09-19 18:16:36 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2015-09-19 18:16:36 +0800 |
commit | e6738ed57d644572e7cbefa6d68a4118935a5f80 (patch) | |
tree | a38b823d4b3771b045239a2f811eb63824a1032c /src/ast/path.cpp | |
parent | 03e211d6eeb3f8f3c6f0b22f77c2074e81443952 (diff) | |
download | mrust-e6738ed57d644572e7cbefa6d68a4118935a5f80.tar.gz |
Disable UFCS resolve (due to ordering issues), fix Self handling
Diffstat (limited to 'src/ast/path.cpp')
-rw-r--r-- | src/ast/path.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/ast/path.cpp b/src/ast/path.cpp index 247a6b2b..8fe42527 100644 --- a/src/ast/path.cpp +++ b/src/ast/path.cpp @@ -115,6 +115,24 @@ AST::Path::Path(const Path& x): ) ) + memcpy(&m_binding, &x.m_binding, sizeof(PathBinding)); + //TU_MATCH(PathBinding, (x.m_binding), (ent), + //(Unbound, m_binding = PathBinding::make_Unbound({}); ), + //(Module, os << "Module"; ), + //(Trait, os << "Trait"; ), + //(Struct, os << "Struct"; ), + //(Enum, os << "Enum"; ), + //(Static, os << "Static"; ), + //(Function, os << "Function";), + //(EnumVar, os << "EnumVar(" << i.idx << ")"; ), + //(TypeAlias, os << "TypeAlias";), + //(StructMethod, os << "StructMethod"; ), + //(TraitMethod, os << "TraitMethod"; ), + // + //(TypeParameter, os << "TypeParameter(" << i.level << " # " << i.idx << ")"; ), + //(Variable, os << "Variable(" << i.slot << ")"; ) + //) + DEBUG("clone, x = " << x << ", this = " << *this ); } @@ -454,7 +472,7 @@ void Path::resolve_ufcs(const Crate& root_crate, bool expect_params) void Path::resolve_ufcs_trait(const AST::Path& trait_path, AST::PathNode& node) { if( !trait_path.m_binding.is_Trait() ) - throw ParseError::Generic("Path::resolve_ufcs - Trait in UFCS path is not a trait"); + ERROR(trait_path.span(), E0000, "Trait in UFCS path is not a trait"); const auto& trait_def = *trait_path.m_binding.as_Trait().trait_; // Check that the requested item exists within the trait, and bind to that item @@ -843,7 +861,6 @@ void Path::print_pretty(::std::ostream& os) const #endif os << n; } - os << "/*" << path.m_binding << "*/"; ), (UFCS, os << "/*ufcs*/<" << *ent.type << " as " << *ent.trait << ">"; @@ -851,7 +868,7 @@ void Path::print_pretty(::std::ostream& os) const os << "::" << n; ) ) - os << "/*[" << path.span().filename << ":" << path.span().start_line << "]*/"; + os << "/*" << path.m_binding << " [" << path.span().filename << ":" << path.span().start_line << "]*/"; #else switch(path.m_class) { |