summaryrefslogtreecommitdiff
path: root/src/parse/root.cpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2015-09-05 12:14:50 +0800
committerJohn Hodge <tpg@mutabah.net>2015-09-05 12:14:50 +0800
commit0b6d7c51056ed7b8eb25af6041c4feb5e6e23051 (patch)
tree33b4f6587a43fb5dae9907db6e94c19880300a73 /src/parse/root.cpp
parentdb10e8219fefb01415b3a79e973844401d97c1ee (diff)
downloadmrust-0b6d7c51056ed7b8eb25af6041c4feb5e6e23051.tar.gz
Resolve - Work resolving UFCS traits
Diffstat (limited to 'src/parse/root.cpp')
-rw-r--r--src/parse/root.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/parse/root.cpp b/src/parse/root.cpp
index d64005a9..832aa209 100644
--- a/src/parse/root.cpp
+++ b/src/parse/root.cpp
@@ -490,11 +490,19 @@ AST::Trait Parse_TraitDef(TokenStream& lex, const AST::MetaItems& meta_items)
}
// Trait bounds "trait Trait : 'lifetime + OtherTrait + OtherTrait2"
+ ::std::vector<AST::Path> supertraits;
if(tok.type() == TOK_COLON)
{
- // 'Self' is a special generic type only valid within traits
- Parse_TypeBound(lex, params, TypeRef(TypeRef::TagArg(), "Self"));
- GET_TOK(tok, lex);
+ do {
+ if( GET_TOK(tok, lex) == TOK_LIFETIME ) {
+ // TODO: Need a better way of indiciating 'static than just an invalid path
+ supertraits.push_back( AST::Path() );
+ }
+ else {
+ lex.putback(tok);
+ supertraits.push_back( Parse_Path(lex, PATH_GENERIC_TYPE) );
+ }
+ } while( GET_TOK(tok, lex) == TOK_PLUS );
}
// TODO: Support "for Sized?"
@@ -507,7 +515,7 @@ AST::Trait Parse_TraitDef(TokenStream& lex, const AST::MetaItems& meta_items)
}
- AST::Trait trait(mv$(meta_items), mv$(params));
+ AST::Trait trait( mv$(meta_items), mv$(params), mv$(supertraits) );
CHECK_TOK(tok, TOK_BRACE_OPEN);
while( GET_TOK(tok, lex) != TOK_BRACE_CLOSE )