Rename DRC rule function onLayer to existsOnLayer.

Fixes https://gitlab.com/kicad/code/kicad/issues/5647
This commit is contained in:
Jeff Young 2020-09-27 18:05:16 +01:00
parent 6f5f6a0fba
commit a2d9acb647
3 changed files with 7 additions and 7 deletions

View File

@ -77,7 +77,7 @@ bool exprFromTo( LIBEVAL::CONTEXT* aCtx, void* self )
}
static void onLayer( LIBEVAL::CONTEXT* aCtx, void *self )
static void existsOnLayer( LIBEVAL::CONTEXT* aCtx, void *self )
{
PCB_EXPR_VAR_REF* vref = static_cast<PCB_EXPR_VAR_REF*>( self );
BOARD_ITEM* item = vref ? vref->GetObject( aCtx ) : nullptr;
@ -94,7 +94,7 @@ static void onLayer( LIBEVAL::CONTEXT* aCtx, void *self )
if( !arg )
{
aCtx->ReportError( wxString::Format( _( "Missing argument to '%s'" ),
wxT( "onLayer()" ) ) );
wxT( "existsOnLayer()" ) ) );
return;
}
@ -342,7 +342,7 @@ PCB_EXPR_BUILTIN_FUNCTIONS::PCB_EXPR_BUILTIN_FUNCTIONS()
void PCB_EXPR_BUILTIN_FUNCTIONS::RegisterAllFunctions()
{
m_funcs.clear();
RegisterFunc( "onLayer('x')", onLayer );
registerFunc( "existsOnLayer('x')", existsOnLayer );
RegisterFunc( "isPlated()", isPlated );
RegisterFunc( "insideCourtyard('x')", insideCourtyard );
RegisterFunc( "insideArea('x')", insideArea );

View File

@ -98,7 +98,7 @@ int main( int argc, char *argv[] )
trackB.SetWidth( Mils2iu( 20 ));
// testEvalExpr( "A.onlayer('F.Cu') || A.onlayer('B.Cu')", VAL( 1.0 ), false, &trackA, &trackB );
testEvalExpr( "A.type == 'Pad' && B.type == 'Pad' && (A.onLayer('F.Cu'))", VAL( 0.0 ), false, &trackA, &trackB );
testEvalExpr( "A.type == 'Pad' && B.type == 'Pad' && (A.existsOnLayer('F.Cu'))", VAL( 0.0 ), false, &trackA, &trackB );
return 0;
testEvalExpr( "A.Width > B.Width", VAL( 0.0 ), false, &trackA, &trackB );
testEvalExpr( "A.Width + B.Width", VAL( Mils2iu(10) + Mils2iu(20) ), false, &trackA, &trackB );

View File

@ -71,7 +71,7 @@ const static std::vector<EXPR_TO_TEST> simpleExpressions = {
const static std::vector<EXPR_TO_TEST> introspectionExpressions = {
{ "A.type == 'Pad' && B.type == 'Pad' && (A.onLayer('F.Cu'))", false, VAL( 0.0 ) },
{ "A.type == 'Pad' && B.type == 'Pad' && (A.existsOnLayer('F.Cu'))", false, VAL( 0.0 ) },
{ "A.Width > B.Width", false, VAL( 0.0 ) },
{ "A.Width + B.Width", false, VAL( Mils2iu(10) + Mils2iu(20) ) },
{ "A.Netclass", false, VAL( "HV" ) },