From 80acf944a02bfb8a29e406982413b5223fc05777 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 18 Sep 2020 22:29:15 +0100 Subject: [PATCH] Don't assert when compiling rules; generate a user-visible error. Fixes https://gitlab.com/kicad/code/kicad/issues/5694 --- common/libeval_compiler/libeval_compiler.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/common/libeval_compiler/libeval_compiler.cpp b/common/libeval_compiler/libeval_compiler.cpp index a76024c0e2..9089c343a4 100644 --- a/common/libeval_compiler/libeval_compiler.cpp +++ b/common/libeval_compiler/libeval_compiler.cpp @@ -733,7 +733,11 @@ bool COMPILER::generateUCode( UCODE* aCode, CONTEXT* aPreflightContext ) { case TR_OP_FUNC_CALL: // 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; break; @@ -743,8 +747,11 @@ bool COMPILER::generateUCode( UCODE* aCode, CONTEXT* aPreflightContext ) // leaf[0]: object // leaf[1]: field (TR_IDENTIFIER) or TR_OP_FUNC_CALL - assert( node->leaf[0]->op == TR_IDENTIFIER ); - //assert( node->leaf[1]->op == TR_IDENTIFIER ); + if( node->leaf[0]->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 ) {