Check for constituent netclasses in DRC netclass equality checks
This reverts previous behaviour whereby 'A.Netclass == x' compared the full name of an effective netclass (e.g. 'Class1,Default'). This was found to be unexpected behaviour to users, who were expecting the equality to compare single netclasses. The equality check now first checks for a constituent class with the given name, and then falls back to a check of the full class name. Inequality requires the netclass name being tested to not be a constituent netclass and to not be the full class name.
This commit is contained in:
@@ -166,18 +166,36 @@ public:
|
||||
return *( m_item->GetEffectiveNetClass() )
|
||||
== *( bValue->m_item->GetEffectiveNetClass() );
|
||||
}
|
||||
else
|
||||
|
||||
if( b->GetType() == LIBEVAL::VT_STRING )
|
||||
{
|
||||
return LIBEVAL::VALUE::EqualTo( aCtx, b );
|
||||
if( m_item->GetEffectiveNetClass()->ContainsNetclassWithName( b->AsString() ) )
|
||||
return true;
|
||||
|
||||
return m_item->GetEffectiveNetClass()->GetName() == b->AsString();
|
||||
}
|
||||
|
||||
return LIBEVAL::VALUE::EqualTo( aCtx, b );
|
||||
}
|
||||
|
||||
bool NotEqualTo( LIBEVAL::CONTEXT* aCtx, const LIBEVAL::VALUE* b ) const override
|
||||
{
|
||||
if( const PCBEXPR_NETCLASS_VALUE* bValue = dynamic_cast<const PCBEXPR_NETCLASS_VALUE*>( b ) )
|
||||
return m_item->GetEffectiveNetClass() != bValue->m_item->GetEffectiveNetClass();
|
||||
else
|
||||
return LIBEVAL::VALUE::NotEqualTo( aCtx, b );
|
||||
{
|
||||
return *( m_item->GetEffectiveNetClass() )
|
||||
!= *( bValue->m_item->GetEffectiveNetClass() );
|
||||
}
|
||||
|
||||
if( b->GetType() == LIBEVAL::VT_STRING )
|
||||
{
|
||||
const bool isInConstituents =
|
||||
m_item->GetEffectiveNetClass()->ContainsNetclassWithName( b->AsString() );
|
||||
const bool isFullName = m_item->GetEffectiveNetClass()->GetName() == b->AsString();
|
||||
|
||||
return !isInConstituents && !isFullName;
|
||||
}
|
||||
|
||||
return LIBEVAL::VALUE::NotEqualTo( aCtx, b );
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
Reference in New Issue
Block a user