summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2015-04-04 11:24:03 +0800
committerJohn Hodge <tpg@mutabah.net>2015-04-04 11:24:03 +0800
commitcd2102b569eac16624c3a3091021ae1fb86b5d58 (patch)
treeabd44088f2517f2b76c8fec844f34456aebb5699 /src
parentf910da73acb47e7d6bdf5efdf5dca26b78280a4a (diff)
downloadmrust-cd2102b569eac16624c3a3091021ae1fb86b5d58.tar.gz
(Minor) commenting on procedure for generic trait checking
Diffstat (limited to 'src')
-rw-r--r--src/ast/ast.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/ast/ast.cpp b/src/ast/ast.cpp
index 93ac87ea..f70f2ec5 100644
--- a/src/ast/ast.cpp
+++ b/src/ast/ast.cpp
@@ -342,9 +342,23 @@ bool Crate::check_impls_wildcard(const Path& trait, const TypeRef& type)
::rust::option<Impl&> Crate::find_impl(const Path& trait, const TypeRef& type)
{
- // TODO: Do a sort to allow a binary search
DEBUG("trait = " << trait << ", type = " << type);
+ // 0. Handle generic bounds
+ // TODO: Handle more complex bounds like "[T]: Trait"
+ if( type.is_type_param() )
+ {
+ // Obtain the relevant TypeParams structure
+ // - TODO: this structure should be pointed to by TypeRef
+ // Search bounds for type: trait
+ // If found, success!
+ // Else, failure
+ // TODO: What should be returned, kinda need to return a boolean
+ }
+
+ // TODO: Do a sort to allow a binary search
+ // 1. Search for wildcard traits (i.e. ones like "impl Send for ..")
+ // - These require special handling, as negatives apply
for( auto implptr : m_impl_index )
{
Impl& impl = *implptr;
@@ -363,6 +377,7 @@ bool Crate::check_impls_wildcard(const Path& trait, const TypeRef& type)
}
+ // 2. Check real impls
DEBUG("Not wildcard");
for( auto implptr : m_impl_index )
{