From f7f3d24fcf16f34f31d35b7e571725dff5e4c42a Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sat, 11 Jun 2016 10:00:27 +0800 Subject: HIR Typecheck - Trait object comparison/manipulation --- src/hir/path.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/hir/path.cpp') diff --git a/src/hir/path.cpp b/src/hir/path.cpp index 6a8b2c07..3cc1d817 100644 --- a/src/hir/path.cpp +++ b/src/hir/path.cpp @@ -85,6 +85,15 @@ namespace HIR { rv.m_types.push_back( t.clone() ); return rv; } +bool ::HIR::PathParams::operator==(const ::HIR::PathParams& x) const +{ + if( m_types.size() != x.m_types.size() ) + return false; + for( unsigned int i = 0; i < m_types.size(); i ++ ) + if( !(m_types[i] == x.m_types[i]) ) + return false; + return true; +} ::HIR::GenericPath::GenericPath() { @@ -102,6 +111,12 @@ namespace HIR { { return GenericPath(m_path.clone(), m_params.clone()); } +bool ::HIR::GenericPath::operator==(const GenericPath& x) const +{ + if( m_path != x.m_path ) + return false; + return m_params == x.m_params; +} ::HIR::Path::Path(::HIR::GenericPath gp): -- cgit v1.2.3