Bug fixes for handling boolean flags in DRC rules.

(cherry picked from commit cb53a18ee3)
This commit is contained in:
Jeff Young
2023-06-02 00:20:11 +01:00
parent f0d205fed9
commit e76a520c19
3 changed files with 9 additions and 1 deletions
+1 -1
View File
@@ -1220,7 +1220,7 @@ void UOP::Exec( CONTEXT* ctx )
result = arg1Value != 0.0 ? 0 : 1;
break;
default:
result = 0.0;
result = arg1Value != 0.0 ? 1 : 0;
break;
}
+4
View File
@@ -345,6 +345,10 @@ protected:
{
wxAny a = getter( aObject );
// We don't currently have a bool type, so change it to a numeric
if( a.CheckType<bool>() )
a = a.RawAs<bool>() ? 1 : 0;
if ( !( std::is_enum<T>::value && a.CheckType<int>() ) && !a.CheckType<T>() )
throw std::invalid_argument( "Invalid requested type" );
+4
View File
@@ -257,6 +257,10 @@ std::unique_ptr<LIBEVAL::VAR_REF> PCB_EXPR_UCODE::CreateVarRef( const wxString&
{
vref->SetType( LIBEVAL::VT_NUMERIC );
}
else if( prop->TypeHash() == TYPE_HASH( bool ) )
{
vref->SetType( LIBEVAL::VT_NUMERIC );
}
else if( prop->TypeHash() == TYPE_HASH( wxString ) )
{
vref->SetType( LIBEVAL::VT_STRING );