Minor reformatting and performance improvement.

This commit is contained in:
Jeff Young 2020-09-16 10:49:54 +01:00
parent b993a29695
commit c0f83b30d3
1 changed files with 23 additions and 20 deletions

View File

@ -60,7 +60,8 @@ bool DRC_RULE_CONDITION::EvaluateFor( const BOARD_ITEM* aItemA, const BOARD_ITEM
PCB_EXPR_CONTEXT ctx( aLayer );
ctx.SetItems( a, b );
ctx.SetErrorCallback( [&]( const wxString& aMessage, int aOffset )
ctx.SetErrorCallback(
[&]( const wxString& aMessage, int aOffset )
{
if( aReporter )
aReporter->Report( _( "ERROR: " ) + aMessage );
@ -72,7 +73,12 @@ bool DRC_RULE_CONDITION::EvaluateFor( const BOARD_ITEM* aItemA, const BOARD_ITEM
bool DRC_RULE_CONDITION::Compile( REPORTER* aReporter, int aSourceLine, int aSourceOffset )
{
auto errorHandler = [&]( const wxString& aMessage, int aOffset )
PCB_EXPR_COMPILER compiler;
compiler.SetErrorCallback(
[&]( const wxString& aMessage, int aOffset )
{
if( aReporter )
{
wxString rest;
wxString first = aMessage.BeforeFirst( '|', &rest );
@ -82,12 +88,9 @@ bool DRC_RULE_CONDITION::Compile( REPORTER* aReporter, int aSourceLine, int aSou
first,
rest );
if( aReporter )
aReporter->Report( msg, RPT_SEVERITY_ERROR );
};
PCB_EXPR_COMPILER compiler;
compiler.SetErrorCallback( errorHandler );
}
} );
m_ucode = std::make_unique<PCB_EXPR_UCODE>();