Don't assert when compiling rules; generate a user-visible error.

Fixes https://gitlab.com/kicad/code/kicad/issues/5694
This commit is contained in:
Jeff Young 2020-09-18 22:29:15 +01:00
parent 67b5d24995
commit 80acf944a0
1 changed files with 10 additions and 3 deletions

View File

@ -733,7 +733,11 @@ bool COMPILER::generateUCode( UCODE* aCode, CONTEXT* aPreflightContext )
{ {
case TR_OP_FUNC_CALL: case TR_OP_FUNC_CALL:
// Function call's uop was generated inside TR_STRUCT_REF // Function call's uop was generated inside TR_STRUCT_REF
assert( node->uop ); if( !node->uop )
{
reportError( CST_CODEGEN, _( "Unknown parent of function parameters" ),
node->srcPos );
}
node->isTerminal = true; node->isTerminal = true;
break; break;
@ -743,8 +747,11 @@ bool COMPILER::generateUCode( UCODE* aCode, CONTEXT* aPreflightContext )
// leaf[0]: object // leaf[0]: object
// leaf[1]: field (TR_IDENTIFIER) or TR_OP_FUNC_CALL // leaf[1]: field (TR_IDENTIFIER) or TR_OP_FUNC_CALL
assert( node->leaf[0]->op == TR_IDENTIFIER ); if( node->leaf[0]->op != TR_IDENTIFIER )
//assert( node->leaf[1]->op == TR_IDENTIFIER ); {
reportError( CST_CODEGEN, _( "Unknown parent of property" ),
node->leaf[0]->srcPos - (int) node->leaf[0]->value.str->length() );
}
switch( node->leaf[1]->op ) switch( node->leaf[1]->op )
{ {