diff options
Diffstat (limited to 'src/hir')
-rw-r--r-- | src/hir/dump.cpp | 2 | ||||
-rw-r--r-- | src/hir/from_ast.cpp | 2 | ||||
-rw-r--r-- | src/hir/hir.cpp | 12 | ||||
-rw-r--r-- | src/hir/hir.hpp | 2 | ||||
-rw-r--r-- | src/hir/type.cpp | 2 |
5 files changed, 15 insertions, 5 deletions
diff --git a/src/hir/dump.cpp b/src/hir/dump.cpp index 90c7c7c1..90b0d1c9 100644 --- a/src/hir/dump.cpp +++ b/src/hir/dump.cpp @@ -198,7 +198,7 @@ namespace { m_os << "const "; if( item.m_unsafe ) m_os << "unsafe "; - if( item.m_abi != "rust" ) + if( item.m_abi != ABI_RUST ) m_os << "extern \"" << item.m_abi << "\" "; m_os << "fn " << p.get_name() << item.m_params.fmt_args() << "("; for(const auto& arg : item.m_args) diff --git a/src/hir/from_ast.cpp b/src/hir/from_ast.cpp index fb0b3186..a6550b07 100644 --- a/src/hir/from_ast.cpp +++ b/src/hir/from_ast.cpp @@ -738,7 +738,7 @@ mv$(args) // TODO: e.info.is_variadic }; if( f.m_abi == "" ) - f.m_abi = "rust"; + f.m_abi = ABI_RUST; return ::HIR::TypeRef( ::HIR::TypeRef::Data::make_Function( mv$(f) ) ); ), (Generic, diff --git a/src/hir/hir.cpp b/src/hir/hir.cpp index 293827d8..404674ac 100644 --- a/src/hir/hir.cpp +++ b/src/hir/hir.cpp @@ -160,8 +160,16 @@ namespace { return matches_type_int(params, *le.inner, *re.inner, ty_res, expand_generic); ), (Function, - DEBUG("TODO: Compare " << left << " and " << right); - return false; + if( le.is_unsafe != re.is_unsafe ) + return false; + if( le.m_abi != re.m_abi ) + return false; + if( le.m_arg_types.size() != re.m_arg_types.size() ) + return false; + for( unsigned int i = 0; i < le.m_arg_types.size(); i ++ ) + if( !matches_type_int(params, le.m_arg_types[i], re.m_arg_types[i], ty_res, expand_generic) ) + return false; + return matches_type_int(params, *le.m_rettype, *re.m_rettype, ty_res, expand_generic); ), (Closure, return le.node == re.node; diff --git a/src/hir/hir.hpp b/src/hir/hir.hpp index 73e1fd95..0c6a5206 100644 --- a/src/hir/hir.hpp +++ b/src/hir/hir.hpp @@ -25,6 +25,8 @@ #include <hir/generic_params.hpp> #include <hir/crate_ptr.hpp> +#define ABI_RUST "Rust" + namespace HIR { class Crate; diff --git a/src/hir/type.cpp b/src/hir/type.cpp index abad9757..15100c15 100644 --- a/src/hir/type.cpp +++ b/src/hir/type.cpp @@ -338,7 +338,7 @@ Ordering HIR::TypeRef::ord(const ::HIR::TypeRef& x) const ORD(*te.inner, *xe.inner); ORD(te.size_val, xe.size_val); if( te.size_val == ~0u ) - assert(!"TOD: Compre array types with non-resolved sizes"); + TODO(Span(), "Compre array types with non-resolved sizes"); return OrdEqual; ), (Slice, |