From db6d0e631e5e0b8e42d7825c688029ce643ebfb9 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Tue, 9 Mar 2010 22:37:50 +0000 Subject: [PATCH] 2010-03-09 23:36 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/include/hbcomp.h * harbour/include/hbcompdf.h * harbour/include/hbexprop.h * harbour/include/hbexpra.c * harbour/include/hbexprb.c * harbour/src/common/expropt1.c * harbour/src/compiler/hbcomp.c * harbour/src/compiler/harbour.y * harbour/src/compiler/harbour.yyc * harbour/src/macro/macro.y * harbour/src/macro/macro.yyc * harbour/src/macro/macro.yyh + added new type of expression: SETGET % eliminated reference counter in expressions (this code was never fully safe because expression optimizer was not respecting multiple references) % replaced all HB_COMP_EXPR_DELETE() macro usage with HB_COMP_EXPR_FREE() and deleted HB_COMP_EXPR_DELETE() macro - removed not longer used hb_compExprClone() Above modifications reduce a little bit total memory consumed by compiler and macrocompiler giving also some minor speed improvement. * harbour/ChangeLog * marked TODO for above modification as DONE. --- harbour/ChangeLog | 28 +++- harbour/include/hbcomp.h | 1 - harbour/include/hbcompdf.h | 14 +- harbour/include/hbexpra.c | 19 +-- harbour/include/hbexprb.c | 225 +++++++++++++++++++++---------- harbour/include/hbexprop.h | 1 - harbour/src/common/expropt1.c | 46 ++----- harbour/src/compiler/harbour.y | 158 +++++++++++----------- harbour/src/compiler/harbour.yyc | 156 ++++++++++----------- harbour/src/compiler/hbcomp.c | 27 +--- harbour/src/macro/macro.y | 24 +--- harbour/src/macro/macro.yyc | 25 +--- harbour/src/macro/macro.yyh | 3 + 13 files changed, 386 insertions(+), 341 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index eee7fbd713..b521995249 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,32 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-03-09 23:36 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/include/hbcomp.h + * harbour/include/hbcompdf.h + * harbour/include/hbexprop.h + * harbour/include/hbexpra.c + * harbour/include/hbexprb.c + * harbour/src/common/expropt1.c + * harbour/src/compiler/hbcomp.c + * harbour/src/compiler/harbour.y + * harbour/src/compiler/harbour.yyc + * harbour/src/macro/macro.y + * harbour/src/macro/macro.yyc + * harbour/src/macro/macro.yyh + + added new type of expression: SETGET + % eliminated reference counter in expressions + (this code was never fully safe because expression optimizer was not + respecting multiple references) + % replaced all HB_COMP_EXPR_DELETE() macro usage with HB_COMP_EXPR_FREE() + and deleted HB_COMP_EXPR_DELETE() macro + - removed not longer used hb_compExprClone() + Above modifications reduce a little bit total memory consumed by + compiler and macrocompiler giving also some minor speed improvement. + + * harbour/ChangeLog + * marked TODO for above modification as DONE. + 2010-03-09 12:33 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + contrib/hbide/resources/panel_1.png + One more missing file. @@ -6604,7 +6630,7 @@ our optimization module does not care about shared expressions so it can be source of serious problems in the future if someone use this functions for non optimized expression which will be - reduced later. + reduced later. [DONE] * emulate clipper behavior for codeblock optimizations and do not optimize all codeblocks if -kc switch is used and codeblocks is inside non optimized part of code like (Clipper has such diff --git a/harbour/include/hbcomp.h b/harbour/include/hbcomp.h index 86d27e8a31..e296ba81ed 100644 --- a/harbour/include/hbcomp.h +++ b/harbour/include/hbcomp.h @@ -240,7 +240,6 @@ extern HB_BOOL hb_compCheckUnclosedStru( HB_COMP_DECL, PFUNCTION ); #define HB_COMP_EXPR_NEW( i ) HB_COMP_PARAM->funcs->ExprNew( HB_COMP_PARAM, i ) #define HB_COMP_EXPR_FREE( x ) HB_COMP_PARAM->funcs->ExprFree( HB_COMP_PARAM, x ) #define HB_COMP_EXPR_CLEAR( x ) HB_COMP_PARAM->funcs->ExprClear( HB_COMP_PARAM, x ) -#define HB_COMP_EXPR_DELETE( x ) HB_COMP_PARAM->funcs->ExprDelete( HB_COMP_PARAM, x ) #if defined( HB_MACRO_SUPPORT ) diff --git a/harbour/include/hbcompdf.h b/harbour/include/hbcompdf.h index 58fe85a1c7..1ee77ca616 100644 --- a/harbour/include/hbcompdf.h +++ b/harbour/include/hbcompdf.h @@ -209,6 +209,7 @@ typedef enum HB_ET_FUNCALL, HB_ET_ALIASVAR, HB_ET_ALIASEXPR, + HB_ET_SETGET, HB_ET_SEND, HB_ET_FUNNAME, HB_ET_ALIAS, @@ -363,7 +364,12 @@ typedef struct HB_EXPR_ { struct HB_EXPR_ * pMacro; /* macro variable */ const char * szName; /* variable name */ - } asRTVar; /* PUBLIC or PRIVATE variable declaration */ + } asRTVar; /* PUBLIC or PRIVATE variable declaration */ + struct + { + struct HB_EXPR_ * pVar; /* variable */ + struct HB_EXPR_ * pExpr; /* expression */ + } asSetGet; /* IIF( ==NIL, , := ) */ struct { union { @@ -424,10 +430,9 @@ typedef struct HB_EXPR_ } asOperator; struct HB_EXPR_ * asReference; } value; - HB_ULONG ulLength; - HB_ULONG Counter; + HB_ULONG ulLength; HB_EXPRTYPE ExprType; /* internal expression type */ - HB_USHORT ValType; /* language level value type */ + HB_USHORT ValType; /* language level value type */ struct HB_EXPR_ *pNext; /* next expression in the list of expressions */ } HB_EXPR, *HB_EXPR_PTR; @@ -841,7 +846,6 @@ typedef struct _HB_COMP_FUNCS HB_EXPR_PTR ( * ExprNew ) ( HB_COMP_DECL, HB_EXPRTYPE iType ); void ( * ExprClear ) ( HB_COMP_DECL, HB_EXPR_PTR pExpr ); void ( * ExprFree ) ( HB_COMP_DECL, HB_EXPR_PTR pExpr ); - void ( * ExprDelete ) ( HB_COMP_DECL, HB_EXPR_PTR pExpr ); HB_EXPR_PTR ( * ErrorType ) ( HB_COMP_DECL, HB_EXPR_PTR ); HB_EXPR_PTR ( * ErrorSyntax ) ( HB_COMP_DECL, HB_EXPR_PTR ); diff --git a/harbour/include/hbexpra.c b/harbour/include/hbexpra.c index 44557af869..0c407b509e 100644 --- a/harbour/include/hbexpra.c +++ b/harbour/include/hbexpra.c @@ -192,8 +192,9 @@ HB_EXPR_PTR hb_compExprNewFunCall( HB_EXPR_PTR pName, HB_EXPR_PTR pParms, HB_COM } if( szName ) { - HB_COMP_EXPR_DELETE( pParms ); - HB_COMP_EXPR_DELETE( pName ); + if( pParms ) + HB_COMP_EXPR_FREE( pParms ); + HB_COMP_EXPR_FREE( pName ); return hb_compExprNewMethodObject( hb_compExprNewSend( szMessage, HB_COMP_PARAM ), hb_compExprNewVar( szName, HB_COMP_PARAM ) ); @@ -219,8 +220,8 @@ HB_EXPR_PTR hb_compExprNewFunCall( HB_EXPR_PTR pName, HB_EXPR_PTR pParms, HB_COM pParms->value.asList.pExprList->pNext, HB_COMP_PARAM ) ); pParms->value.asList.pExprList = NULL; - HB_COMP_EXPR_DELETE( pParms ); - HB_COMP_EXPR_DELETE( pName ); + HB_COMP_EXPR_FREE( pParms ); + HB_COMP_EXPR_FREE( pName ); return pEval; } else if( pName->value.asSymbol.funcid == HB_F__GET_ && @@ -316,7 +317,7 @@ HB_EXPR_PTR hb_compExprNewFunCall( HB_EXPR_PTR pName, HB_EXPR_PTR pParms, HB_COM if( pVar->pNext ) /* Delete 6-th argument if present */ { pIndex->pNext = pVar->pNext->pNext; - HB_COMP_EXPR_DELETE( pVar->pNext ); + HB_COMP_EXPR_FREE( pVar->pNext ); } pVar->pNext = pIndex; /* Set a new 6-th argument */ @@ -377,12 +378,12 @@ HB_EXPR_PTR hb_compExprNewFunCall( HB_EXPR_PTR pName, HB_EXPR_PTR pParms, HB_COM /* simple &variable - replace the second argument with * a variable name */ - const char *szName = pFirst->value.asMacro.szMacro; + const char * szName = pFirst->value.asMacro.szMacro; if( pFirst->pNext ) - HB_COMP_EXPR_DELETE( pFirst->pNext ); /* delete a second argument */ + HB_COMP_EXPR_FREE( pFirst->pNext ); /* delete a second argument */ pArg->pNext = hb_compExprNewVar( szName, HB_COMP_PARAM ); pArg->pNext->pNext = pNext; /* restore third argument */ - HB_COMP_EXPR_DELETE( pFirst ); + HB_COMP_EXPR_FREE( pFirst ); } else { @@ -396,7 +397,7 @@ HB_EXPR_PTR hb_compExprNewFunCall( HB_EXPR_PTR pName, HB_EXPR_PTR pParms, HB_COM pArg->pNext = hb_compExprNewString( szText, strlen( szText ), HB_FALSE, HB_COMP_PARAM ); pArg->pNext->pNext = pNext; } - HB_COMP_EXPR_DELETE( pFirst ); /* delete first argument */ + HB_COMP_EXPR_FREE( pFirst ); /* delete first argument */ } } else diff --git a/harbour/include/hbexprb.c b/harbour/include/hbexprb.c index 00b2890677..7b489b4c0c 100644 --- a/harbour/include/hbexprb.c +++ b/harbour/include/hbexprb.c @@ -91,6 +91,7 @@ static HB_EXPR_FUNC( hb_compExprUseMacro ); static HB_EXPR_FUNC( hb_compExprUseFunCall ); static HB_EXPR_FUNC( hb_compExprUseAliasVar ); static HB_EXPR_FUNC( hb_compExprUseAliasExpr ); +static HB_EXPR_FUNC( hb_compExprUseSetGet ); static HB_EXPR_FUNC( hb_compExprUseSend ); static HB_EXPR_FUNC( hb_compExprUseFunName ); static HB_EXPR_FUNC( hb_compExprUseAlias ); @@ -173,6 +174,7 @@ const HB_EXPR_FUNC_PTR hb_comp_ExprTable[ HB_EXPR_COUNT ] = { hb_compExprUseFunCall, hb_compExprUseAliasVar, hb_compExprUseAliasExpr, + hb_compExprUseSetGet, hb_compExprUseSend, hb_compExprUseFunName, hb_compExprUseAlias, @@ -481,7 +483,7 @@ static HB_EXPR_FUNC( hb_compExprUseCodeblock ) while( pExpr ) { HB_EXPR_PTR pNext = pExpr->pNext; - HB_COMP_EXPR_DELETE( pExpr ); + HB_COMP_EXPR_FREE( pExpr ); pExpr = pNext; } break; @@ -639,7 +641,7 @@ static HB_EXPR_FUNC( hb_compExprUseArray ) while( pElem ) { HB_EXPR_PTR pNext = pElem->pNext; - HB_COMP_EXPR_DELETE( pElem ); + HB_COMP_EXPR_FREE( pElem ); pElem = pNext; } } @@ -710,7 +712,7 @@ static HB_EXPR_FUNC( hb_compExprUseHash ) while( pElem ) { HB_EXPR_PTR pNext = pElem->pNext; - HB_COMP_EXPR_DELETE( pElem ); + HB_COMP_EXPR_FREE( pElem ); pElem = pNext; } } @@ -880,7 +882,7 @@ static HB_EXPR_FUNC( hb_compExprUseRef ) case HB_EA_STATEMENT: hb_compWarnMeaningless( HB_COMP_PARAM, pSelf ); case HB_EA_DELETE: - HB_COMP_EXPR_DELETE( pSelf->value.asReference ); + HB_COMP_EXPR_FREE( pSelf->value.asReference ); break; } return pSelf; @@ -1004,7 +1006,7 @@ static HB_EXPR_FUNC( hb_compExprUseIIF ) while( pExpr ) { pNext = pExpr->pNext; /* store next expression */ - HB_COMP_EXPR_DELETE( pExpr ); + HB_COMP_EXPR_FREE( pExpr ); pExpr = pNext; } pSelf->value.asList.pExprList = NULL; @@ -1127,8 +1129,8 @@ static HB_EXPR_FUNC( hb_compExprUseList ) while( pExpr ) { pNext = pExpr->pNext; /* store next expression */ - HB_COMP_EXPR_DELETE( pExpr ); - pExpr =pNext; + HB_COMP_EXPR_FREE( pExpr ); + pExpr = pNext; } pSelf->value.asList.pExprList = NULL; } @@ -1190,8 +1192,8 @@ static HB_EXPR_FUNC( hb_compExprUseArgList ) while( pExpr ) { pNext = pExpr->pNext; /* store next expression */ - HB_COMP_EXPR_DELETE( pExpr ); - pExpr =pNext; + HB_COMP_EXPR_FREE( pExpr ); + pExpr = pNext; } pSelf->value.asList.pExprList = NULL; } @@ -1262,8 +1264,8 @@ static HB_EXPR_FUNC( hb_compExprUseMacroArgList ) while( pExpr ) { pNext = pExpr->pNext; /* store next expression */ - HB_COMP_EXPR_DELETE( pExpr ); - pExpr =pNext; + HB_COMP_EXPR_FREE( pExpr ); + pExpr = pNext; } pSelf->value.asList.pExprList = NULL; } @@ -1348,7 +1350,7 @@ static HB_EXPR_FUNC( hb_compExprUseArrayAt ) */ pExpr->ExprType = HB_ET_NONE; /* Here comes the magic */ - HB_COMP_EXPR_DELETE( pSelf ); + HB_COMP_EXPR_FREE( pSelf ); pSelf = pNew; } else if( !HB_SUPPORT_ARRSTR ) @@ -1362,7 +1364,7 @@ static HB_EXPR_FUNC( hb_compExprUseArrayAt ) { HB_UCHAR ucValue = ( HB_UCHAR ) pExpr->value.asString.string[ lIndex - 1 ]; - HB_COMP_EXPR_DELETE( pSelf ); + HB_COMP_EXPR_FREE( pSelf ); pSelf = hb_compExprNewLong( ucValue, HB_COMP_PARAM ); } else @@ -1549,8 +1551,8 @@ static HB_EXPR_FUNC( hb_compExprUseArrayAt ) break; case HB_EA_DELETE: - HB_COMP_EXPR_DELETE( pSelf->value.asList.pExprList ); - HB_COMP_EXPR_DELETE( pSelf->value.asList.pIndex ); + HB_COMP_EXPR_FREE( pSelf->value.asList.pExprList ); + HB_COMP_EXPR_FREE( pSelf->value.asList.pIndex ); break; } return pSelf; @@ -1713,7 +1715,7 @@ static HB_EXPR_FUNC( hb_compExprUseMacro ) case HB_EA_DELETE: if( pSelf->value.asMacro.pExprList ) - HB_COMP_EXPR_DELETE( pSelf->value.asMacro.pExprList ); + HB_COMP_EXPR_FREE( pSelf->value.asMacro.pExprList ); break; } return pSelf; @@ -2170,8 +2172,8 @@ static HB_EXPR_FUNC( hb_compExprUseFunCall ) } case HB_EA_DELETE: if( pSelf->value.asFunCall.pParms ) - HB_COMP_EXPR_DELETE( pSelf->value.asFunCall.pParms ); - HB_COMP_EXPR_DELETE( pSelf->value.asFunCall.pFunName ); + HB_COMP_EXPR_FREE( pSelf->value.asFunCall.pParms ); + HB_COMP_EXPR_FREE( pSelf->value.asFunCall.pFunName ); break; } return pSelf; @@ -2315,9 +2317,9 @@ static HB_EXPR_FUNC( hb_compExprUseAliasVar ) break; case HB_EA_DELETE: - HB_COMP_EXPR_DELETE( pSelf->value.asAlias.pAlias ); + HB_COMP_EXPR_FREE( pSelf->value.asAlias.pAlias ); if( pSelf->value.asAlias.pVar ) - HB_COMP_EXPR_DELETE( pSelf->value.asAlias.pVar ); + HB_COMP_EXPR_FREE( pSelf->value.asAlias.pVar ); break; } return pSelf; @@ -2392,8 +2394,8 @@ static HB_EXPR_FUNC( hb_compExprUseAliasExpr ) break; case HB_EA_DELETE: - HB_COMP_EXPR_DELETE( pSelf->value.asAlias.pAlias ); - HB_COMP_EXPR_DELETE( pSelf->value.asAlias.pExpList ); + HB_COMP_EXPR_FREE( pSelf->value.asAlias.pAlias ); + HB_COMP_EXPR_FREE( pSelf->value.asAlias.pExpList ); break; } return pSelf; @@ -2476,14 +2478,13 @@ static HB_EXPR_FUNC( hb_compExprUseRTVariable ) case HB_EA_DELETE: #if ! defined( HB_MACRO_SUPPORT ) if( ! pSelf->value.asRTVar.szName ) - HB_COMP_EXPR_DELETE( pSelf->value.asRTVar.pMacro ); + HB_COMP_EXPR_FREE( pSelf->value.asRTVar.pMacro ); #endif break; } return pSelf; } - static HB_EXPR_FUNC( hb_compExprUseVariable ) { switch( iMessage ) @@ -2495,33 +2496,29 @@ static HB_EXPR_FUNC( hb_compExprUseVariable ) break; case HB_EA_PUSH_PCODE: #if defined( HB_MACRO_SUPPORT ) - { - /* NOTE: When the following syntax is used: - * ( any_expr )->&var2 - * then macro compiler is compiling the right side of alias - * operator only (if 'any_expr' is not a string) - an alias value - * is placed on the eval stack before macro compilation. - * The HB_MACRO_GEN_ALIASED flag is used to signal that we have to - * genearate alias aware pcode even if we known a variable part only. - */ - if( HB_MACRO_DATA->Flags & HB_MACRO_GEN_ALIASED ) - HB_GEN_FUNC4( PushAliasedVar, pSelf->value.asSymbol.name, HB_FALSE, NULL, 0 ); - else - HB_GEN_FUNC2( PushVar, pSelf->value.asSymbol.name, HB_FALSE ); - } + /* NOTE: When the following syntax is used: + * ( any_expr )->&var2 + * then macro compiler is compiling the right side of alias + * operator only (if 'any_expr' is not a string) - an alias value + * is placed on the eval stack before macro compilation. + * The HB_MACRO_GEN_ALIASED flag is used to signal that we have to + * genearate alias aware pcode even if we known a variable part only. + */ + if( HB_MACRO_DATA->Flags & HB_MACRO_GEN_ALIASED ) + HB_GEN_FUNC4( PushAliasedVar, pSelf->value.asSymbol.name, HB_FALSE, NULL, 0 ); + else + HB_GEN_FUNC2( PushVar, pSelf->value.asSymbol.name, HB_FALSE ); #else HB_GEN_FUNC2( PushVar, pSelf->value.asSymbol.name, HB_FALSE ); #endif - break; + break; - case HB_EA_POP_PCODE: + case HB_EA_POP_PCODE: #if defined( HB_MACRO_SUPPORT ) - { - if( HB_MACRO_DATA->Flags & HB_MACRO_GEN_ALIASED ) - HB_GEN_FUNC4( PopAliasedVar, pSelf->value.asSymbol.name, HB_FALSE, NULL, 0 ); - else - HB_GEN_FUNC1( PopVar, pSelf->value.asSymbol.name ); - } + if( HB_MACRO_DATA->Flags & HB_MACRO_GEN_ALIASED ) + HB_GEN_FUNC4( PopAliasedVar, pSelf->value.asSymbol.name, HB_FALSE, NULL, 0 ); + else + HB_GEN_FUNC1( PopVar, pSelf->value.asSymbol.name ); #else HB_GEN_FUNC1( PopVar, pSelf->value.asSymbol.name ); #endif @@ -2539,6 +2536,98 @@ static HB_EXPR_FUNC( hb_compExprUseVariable ) return pSelf; } +/* IIF( ==NIL, , := ) */ +static HB_EXPR_FUNC( hb_compExprUseSetGet ) +{ + switch( iMessage ) + { + case HB_EA_REDUCE: + pSelf->value.asSetGet.pVar = HB_EXPR_USE( pSelf->value.asSetGet.pVar, HB_EA_REDUCE ); + pSelf->value.asSetGet.pExpr = HB_EXPR_USE( pSelf->value.asSetGet.pExpr, HB_EA_REDUCE ); + HB_EXPR_USE( pSelf->value.asSetGet.pVar, HB_EA_LVALUE ); + break; + case HB_EA_ARRAY_AT: + case HB_EA_ARRAY_INDEX: + case HB_EA_LVALUE: + break; + case HB_EA_PUSH_PCODE: + { + HB_LONG lPosFalse, lPosEnd; + + /* ==NIL */ + HB_EXPR_USE( pSelf->value.asSetGet.pVar, HB_EA_PUSH_PCODE ); + HB_GEN_FUNC1( PCode1, HB_P_PUSHNIL ); + HB_GEN_FUNC1( PCode1, HB_P_EXACTLYEQUAL ); + lPosFalse = HB_GEN_FUNC1( JumpFalse, 0 ); + /* */ + HB_EXPR_USE( pSelf->value.asSetGet.pExpr, HB_EA_PUSH_PCODE ); + lPosEnd = HB_GEN_FUNC1( Jump, 0 ); + /* := */ + HB_GEN_FUNC1( JumpHere, lPosFalse ); + if( pSelf->value.asSetGet.pExpr->ExprType == HB_ET_SEND ) + { + HB_EXPR_PTR pObj, pParams; + pObj = pSelf->value.asSetGet.pExpr; + pParams = pObj->value.asMessage.pParms; + pObj->value.asMessage.pParms = pSelf->value.asSetGet.pVar; + HB_EXPR_USE( pObj, HB_EA_POP_PCODE ); + pObj->value.asMessage.pParms = pParams; + } + else + { + HB_EXPR_USE( pSelf->value.asSetGet.pVar, HB_EA_PUSH_PCODE ); + HB_GEN_FUNC1( PCode1, HB_P_PUSHUNREF ); + HB_EXPR_USE( pSelf->value.asSetGet.pExpr, HB_EA_POP_PCODE ); + } + HB_GEN_FUNC1( JumpHere, lPosEnd ); + break; + } + case HB_EA_POP_PCODE: + break; + + case HB_EA_PUSH_POP: + case HB_EA_STATEMENT: + { + HB_LONG lPosFalse, lPosEnd; + + /* ==NIL */ + HB_EXPR_USE( pSelf->value.asSetGet.pVar, HB_EA_PUSH_PCODE ); + HB_GEN_FUNC1( PCode1, HB_P_PUSHNIL ); + HB_GEN_FUNC1( PCode1, HB_P_EXACTLYEQUAL ); + lPosFalse = HB_GEN_FUNC1( JumpFalse, 0 ); + /* */ + HB_EXPR_USE( pSelf->value.asSetGet.pExpr, HB_EA_PUSH_PCODE ); + lPosEnd = HB_GEN_FUNC1( Jump, 0 ); + /* := */ + HB_GEN_FUNC1( JumpHere, lPosFalse ); + if( pSelf->value.asSetGet.pExpr->ExprType == HB_ET_SEND ) + { + HB_EXPR_PTR pObj, pParams; + pObj = pSelf->value.asSetGet.pExpr; + pParams = pObj->value.asMessage.pParms; + pObj->value.asMessage.pParms = pSelf->value.asSetGet.pVar; + HB_EXPR_USE( pObj, HB_EA_POP_PCODE ); + pObj->value.asMessage.pParms = pParams; + /* Remove the return value */ + HB_GEN_FUNC1( PCode1, HB_P_POP ); + } + else + { + HB_EXPR_USE( pSelf->value.asSetGet.pVar, HB_EA_PUSH_PCODE ); + HB_EXPR_USE( pSelf->value.asSetGet.pExpr, HB_EA_POP_PCODE ); + } + HB_GEN_FUNC1( JumpHere, lPosEnd ); + break; + } + + case HB_EA_DELETE: + HB_COMP_EXPR_FREE( pSelf->value.asSetGet.pExpr ); + HB_COMP_EXPR_FREE( pSelf->value.asSetGet.pVar ); + break; + } + return pSelf; +} + static HB_EXPR_FUNC( hb_compExprUseSend ) { switch( iMessage ) @@ -2626,17 +2715,11 @@ static HB_EXPR_FUNC( hb_compExprUseSend ) case HB_EA_DELETE: { if( pSelf->value.asMessage.pObject ) - { - HB_COMP_EXPR_DELETE( pSelf->value.asMessage.pObject ); - } + HB_COMP_EXPR_FREE( pSelf->value.asMessage.pObject ); if( pSelf->value.asMessage.pParms ) - { - HB_COMP_EXPR_DELETE( pSelf->value.asMessage.pParms ); - } + HB_COMP_EXPR_FREE( pSelf->value.asMessage.pParms ); if( pSelf->value.asMessage.pMessage ) - { - HB_COMP_EXPR_DELETE( pSelf->value.asMessage.pMessage ); - } + HB_COMP_EXPR_FREE( pSelf->value.asMessage.pMessage ); } break; } @@ -2675,7 +2758,7 @@ static HB_EXPR_FUNC( hb_compExprUsePostInc ) case HB_EA_DELETE: if( pSelf->value.asOperator.pLeft ) - HB_COMP_EXPR_DELETE( pSelf->value.asOperator.pLeft ); + HB_COMP_EXPR_FREE( pSelf->value.asOperator.pLeft ); break; } return pSelf; @@ -2711,7 +2794,7 @@ static HB_EXPR_FUNC( hb_compExprUsePostDec ) case HB_EA_DELETE: if( pSelf->value.asOperator.pLeft ) - HB_COMP_EXPR_DELETE( pSelf->value.asOperator.pLeft ); + HB_COMP_EXPR_FREE( pSelf->value.asOperator.pLeft ); break; } return pSelf; @@ -2783,10 +2866,12 @@ static HB_EXPR_FUNC( hb_compExprUseAssign ) */ if( pSelf->value.asOperator.pLeft->ExprType == HB_ET_SEND ) { - HB_EXPR_PTR pObj = pSelf->value.asOperator.pLeft; + HB_EXPR_PTR pObj, pParams; + pObj = pSelf->value.asOperator.pLeft; + pParams = pObj->value.asMessage.pParms; pObj->value.asMessage.pParms = pSelf->value.asOperator.pRight; HB_EXPR_USE( pObj, HB_EA_POP_PCODE ); - pObj->value.asMessage.pParms = NULL; /* to suppress duplicated releasing */ + pObj->value.asMessage.pParms = pParams; } else { @@ -2809,10 +2894,12 @@ static HB_EXPR_FUNC( hb_compExprUseAssign ) */ if( pSelf->value.asOperator.pLeft->ExprType == HB_ET_SEND ) { - HB_EXPR_PTR pObj = pSelf->value.asOperator.pLeft; + HB_EXPR_PTR pObj, pParams; + pObj = pSelf->value.asOperator.pLeft; + pParams = pObj->value.asMessage.pParms; pObj->value.asMessage.pParms = pSelf->value.asOperator.pRight; HB_EXPR_USE( pObj, HB_EA_POP_PCODE ); - pObj->value.asMessage.pParms = NULL; /* to suppress duplicated releasing */ + pObj->value.asMessage.pParms = pParams; /* Remove the return value */ HB_GEN_FUNC1( PCode1, HB_P_POP ); } @@ -3265,7 +3352,7 @@ static HB_EXPR_FUNC( hb_compExprUseNot ) */ pExpr->ExprType = HB_ET_NONE; /* do not delete operator parameter - we are still using it */ pExpr = pExpr->value.asOperator.pLeft; - HB_COMP_EXPR_DELETE( pSelf ); + HB_COMP_EXPR_FREE( pSelf ); pSelf = pExpr; } break; @@ -3310,7 +3397,7 @@ static HB_EXPR_FUNC( hb_compExprUseNot ) break; case HB_EA_DELETE: - HB_COMP_EXPR_DELETE( pSelf->value.asOperator.pLeft ); + HB_COMP_EXPR_FREE( pSelf->value.asOperator.pLeft ); break; } return pSelf; @@ -4231,7 +4318,7 @@ static HB_EXPR_FUNC( hb_compExprUseNegate ) case HB_EA_DELETE: if( pSelf->value.asOperator.pLeft ) - HB_COMP_EXPR_DELETE( pSelf->value.asOperator.pLeft ); + HB_COMP_EXPR_FREE( pSelf->value.asOperator.pLeft ); break; } return pSelf; @@ -4271,7 +4358,7 @@ static HB_EXPR_FUNC( hb_compExprUsePreInc ) case HB_EA_DELETE: if( pSelf->value.asOperator.pLeft ) - HB_COMP_EXPR_DELETE( pSelf->value.asOperator.pLeft ); + HB_COMP_EXPR_FREE( pSelf->value.asOperator.pLeft ); break; } return pSelf; @@ -4311,7 +4398,7 @@ static HB_EXPR_FUNC( hb_compExprUsePreDec ) case HB_EA_DELETE: if( pSelf->value.asOperator.pLeft ) - HB_COMP_EXPR_DELETE( pSelf->value.asOperator.pLeft ); + HB_COMP_EXPR_FREE( pSelf->value.asOperator.pLeft ); break; } return pSelf; @@ -4449,7 +4536,7 @@ static void hb_compExprCodeblockEarly( HB_EXPR_PTR pSelf, HB_COMP_DECL ) pNew = hb_compExprSetOperand( hb_compExprNewPlus( pNew, HB_COMP_PARAM ), hb_compExprNewString( "}", 1, HB_FALSE, HB_COMP_PARAM ), HB_COMP_PARAM ); pNew = hb_compExprNewMacro( pNew, 0, NULL, HB_COMP_PARAM ); HB_EXPR_USE( pNew, HB_EA_PUSH_PCODE ); - HB_COMP_EXPR_DELETE( pNew ); + HB_COMP_EXPR_FREE( pNew ); } else { @@ -4459,7 +4546,7 @@ static void hb_compExprCodeblockEarly( HB_EXPR_PTR pSelf, HB_COMP_DECL ) hb_compExprCodeblockPush( pSelf, HB_FALSE, HB_COMP_PARAM ); pExpr = hb_compExprNewMacro( hb_compExprNewString( pSelf->value.asCodeblock.string, pSelf->ulLength, HB_FALSE, HB_COMP_PARAM ), 0, NULL, HB_COMP_PARAM ); HB_EXPR_USE( pExpr, HB_EA_PUSH_PCODE ); - HB_COMP_EXPR_DELETE( pExpr ); + HB_COMP_EXPR_FREE( pExpr ); hb_compCodeBlockStop( HB_COMP_PARAM ); } } @@ -5346,7 +5433,7 @@ static HB_EXPR_PTR hb_compExprReduceAliasString( HB_EXPR_PTR pExpr, HB_EXPR_PTR else if( pAlias->value.asString.dealloc ) szAlias = hb_compIdentifierNew( HB_COMP_PARAM, szAlias, HB_IDENT_COPY ); #endif - HB_COMP_EXPR_DELETE( pExpr ); + HB_COMP_EXPR_FREE( pExpr ); pExpr = hb_compExprNewAlias( szAlias, HB_COMP_PARAM ); } } diff --git a/harbour/include/hbexprop.h b/harbour/include/hbexprop.h index 5098e5a32f..ada364c03f 100644 --- a/harbour/include/hbexprop.h +++ b/harbour/include/hbexprop.h @@ -147,7 +147,6 @@ extern HB_EXPR_PTR hb_compExprMacroAsAlias( HB_EXPR_PTR ); extern HB_EXPR_PTR hb_compExprAssign( HB_EXPR_PTR, HB_EXPR_PTR, HB_COMP_DECL ); extern HB_EXPR_PTR hb_compExprEqual( HB_EXPR_PTR, HB_EXPR_PTR ); extern HB_EXPR_PTR hb_compExprAssignStatic( HB_EXPR_PTR, HB_EXPR_PTR, HB_COMP_DECL ); -extern HB_EXPR_PTR hb_compExprClone( HB_EXPR_PTR pSrc ); extern HB_BOOL hb_compExprListTypeCheck( HB_EXPR_PTR pExpr, HB_EXPRTYPE ExprType ); extern HB_ULONG hb_compExprListLen( HB_EXPR_PTR ); extern HB_ULONG hb_compExprParamListLen( HB_EXPR_PTR ); diff --git a/harbour/src/common/expropt1.c b/harbour/src/common/expropt1.c index 0dd3660994..88f5ee6a72 100644 --- a/harbour/src/common/expropt1.c +++ b/harbour/src/common/expropt1.c @@ -82,6 +82,7 @@ static const char * s_OperTable[ HB_EXPR_COUNT ] = { "()", "->", "->", + "(:=)", /* setget */ ":", "", /* symbol */ "", /* alias */ @@ -147,6 +148,7 @@ static const HB_BYTE s_PrecedTable[ HB_EXPR_COUNT ] = { HB_ET_NIL, /* HB_ET_FUNCALL, */ HB_ET_NIL, /* HB_ET_ALIASVAR, */ HB_ET_NIL, /* HB_ET_ALIASEXPR, */ + HB_ET_NIL, /* HB_ET_SETGET, */ HB_ET_NIL, /* HB_ET_SEND, */ HB_ET_NIL, /* HB_ET_FUNNAME, */ HB_ET_NIL, /* HB_ET_ALIAS, */ @@ -185,15 +187,6 @@ static const HB_BYTE s_PrecedTable[ HB_EXPR_COUNT ] = { /* ************************************************************************* */ -/* Increase a reference counter (this allows to share the same expression - * in more then one context) - */ -HB_EXPR_PTR hb_compExprClone( HB_EXPR_PTR pSrc ) -{ - pSrc->Counter++; - return pSrc; -} - const char * hb_compExprDescription( HB_EXPR_PTR pExpr ) { if( pExpr ) @@ -1485,39 +1478,20 @@ void hb_compExprCBVarDel( HB_CBVAR_PTR pVars ) /* Creates a set/get codeblock for passed expression used in __GET * - * {|var| IIF( var==NIL, , :=var )} + * { | ~1 | IIF( ~1 == NIL, , := ~1 )} + * + * NOTE: "~1" is not a valid variable name so there will be no collisions */ HB_EXPR_PTR hb_compExprSetGetBlock( HB_EXPR_PTR pExpr, HB_COMP_DECL ) { - HB_EXPR_PTR pIIF; HB_EXPR_PTR pSet; - /* NOTE: this is the only code which uses hb_compExprClone(). - * It's important to reduce pExpr before because it should - * not be changed later and our expression optimizer does - * not respect cloned expressions. - */ - - /* create {|var| expression - * NOTE: "~1" is not a valid variable name so there will be no collisions - */ - /* create var==NIL */ - pIIF = hb_compExprSetOperand( hb_compExprNewEQ( hb_compExprNewVar( "~1", HB_COMP_PARAM ), HB_COMP_PARAM ), - hb_compExprNewNil( HB_COMP_PARAM ), HB_COMP_PARAM ); - /* create ( var==NIL, */ - pIIF = hb_compExprNewList( pIIF, HB_COMP_PARAM ); - /* create ( var==NIL, , */ - pIIF = hb_compExprAddListExpr( pIIF, pExpr ); - /* create var */ - pSet =hb_compExprNewVar( "~1", HB_COMP_PARAM ); - /* create :=var */ - pSet = hb_compExprAssign( hb_compExprClone( pExpr ), pSet, HB_COMP_PARAM ); - /* create ( var==nil, , :=var ) */ - pIIF = hb_compExprAddListExpr( pIIF, pSet ); - /* create IIF() expression */ - pIIF = hb_compExprNewIIF( pIIF ); + /* create setget expression: IIF( var==NIL, , :=var ) */ + pSet = HB_COMP_EXPR_NEW( HB_ET_SETGET ); + pSet->value.asSetGet.pVar = hb_compExprNewVar( "~1", HB_COMP_PARAM ); + pSet->value.asSetGet.pExpr = pExpr; /* create a codeblock */ return hb_compExprAddCodeblockExpr( hb_compExprCBVarAdd( hb_compExprNewCodeBlock( NULL, 0, 0, HB_COMP_PARAM ), - "~1", ' ', HB_COMP_PARAM ), pIIF ); + "~1", ' ', HB_COMP_PARAM ), pSet ); } diff --git a/harbour/src/compiler/harbour.y b/harbour/src/compiler/harbour.y index 9bd502a9d5..aaee217def 100644 --- a/harbour/src/compiler/harbour.y +++ b/harbour/src/compiler/harbour.y @@ -265,7 +265,7 @@ extern void yyerror( HB_COMP_DECL, const char * ); /* parsing error manageme expressions which we freed ourself. %destructor { - HB_COMP_EXPR_DELETE( $$ ); + HB_COMP_EXPR_FREE( $$ ); } Argument ExtArgument ArgList ... */ @@ -363,28 +363,28 @@ ParamList : IdentName AsType { hb_compVariableAdd( HB_COMP_PARAM * stop compilation if invalid syntax will be used. */ Statement : ExecFlow CrlfStmnt - | IfInline CrlfStmnt { HB_COMP_EXPR_DELETE( hb_compExprGenStatement( $1, HB_COMP_PARAM ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; } - | FunCall CrlfStmnt { HB_COMP_EXPR_DELETE( hb_compExprGenStatement( $1, HB_COMP_PARAM ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; } - | AliasExpr CrlfStmnt { HB_COMP_EXPR_DELETE( hb_compExprGenStatement( $1, HB_COMP_PARAM ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; } - | ObjectMethod CrlfStmnt { HB_COMP_EXPR_DELETE( hb_compExprGenStatement( $1, HB_COMP_PARAM ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; } + | IfInline CrlfStmnt { HB_COMP_EXPR_FREE( hb_compExprGenStatement( $1, HB_COMP_PARAM ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; } + | FunCall CrlfStmnt { HB_COMP_EXPR_FREE( hb_compExprGenStatement( $1, HB_COMP_PARAM ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; } + | AliasExpr CrlfStmnt { HB_COMP_EXPR_FREE( hb_compExprGenStatement( $1, HB_COMP_PARAM ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; } + | ObjectMethod CrlfStmnt { HB_COMP_EXPR_FREE( hb_compExprGenStatement( $1, HB_COMP_PARAM ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; } | MacroAny CrlfStmnt { if( HB_COMP_ISSUPPORTED( HB_COMPFLAG_XBASE ) ) - HB_COMP_EXPR_DELETE( hb_compExprGenStatement( $1, HB_COMP_PARAM ) ); + HB_COMP_EXPR_FREE( hb_compExprGenStatement( $1, HB_COMP_PARAM ) ); else - HB_COMP_EXPR_DELETE( HB_COMP_ERROR_SYNTAX( $1 ) ); + HB_COMP_EXPR_FREE( HB_COMP_ERROR_SYNTAX( $1 ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; } - | PareExpList CrlfStmnt { HB_COMP_EXPR_DELETE( hb_compExprGenStatement( $1, HB_COMP_PARAM ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; } - | ExprPreOp CrlfStmnt { HB_COMP_EXPR_DELETE( hb_compExprGenStatement( $1, HB_COMP_PARAM ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; } - | ExprPostOp CrlfStmnt { HB_COMP_EXPR_DELETE( hb_compExprGenStatement( $1, HB_COMP_PARAM ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; } - | ExprOperEq CrlfStmnt { HB_COMP_EXPR_DELETE( hb_compExprGenStatement( $1, HB_COMP_PARAM ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; } - | ExprEqual CrlfStmnt { HB_COMP_EXPR_DELETE( hb_compExprGenStatement( $1, HB_COMP_PARAM ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; } - | ExprAssign CrlfStmnt { HB_COMP_EXPR_DELETE( hb_compExprGenStatement( $1, HB_COMP_PARAM ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; } - | DoProc CrlfStmnt { HB_COMP_EXPR_DELETE( hb_compExprGenStatement( $1, HB_COMP_PARAM ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; } + | PareExpList CrlfStmnt { HB_COMP_EXPR_FREE( hb_compExprGenStatement( $1, HB_COMP_PARAM ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; } + | ExprPreOp CrlfStmnt { HB_COMP_EXPR_FREE( hb_compExprGenStatement( $1, HB_COMP_PARAM ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; } + | ExprPostOp CrlfStmnt { HB_COMP_EXPR_FREE( hb_compExprGenStatement( $1, HB_COMP_PARAM ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; } + | ExprOperEq CrlfStmnt { HB_COMP_EXPR_FREE( hb_compExprGenStatement( $1, HB_COMP_PARAM ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; } + | ExprEqual CrlfStmnt { HB_COMP_EXPR_FREE( hb_compExprGenStatement( $1, HB_COMP_PARAM ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; } + | ExprAssign CrlfStmnt { HB_COMP_EXPR_FREE( hb_compExprGenStatement( $1, HB_COMP_PARAM ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; } + | DoProc CrlfStmnt { HB_COMP_EXPR_FREE( hb_compExprGenStatement( $1, HB_COMP_PARAM ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; } | BREAK CrlfStmnt { hb_compGenBreak( HB_COMP_PARAM ); hb_compGenPCode2( HB_P_DOSHORT, 0, HB_COMP_PARAM ); HB_COMP_PARAM->functions.pLast->funFlags |= FUN_BREAK_CODE; } | BREAK { hb_compLinePushIfInside( HB_COMP_PARAM ); } Expression Crlf { - hb_compGenBreak( HB_COMP_PARAM ); HB_COMP_EXPR_DELETE( hb_compExprGenPush( $3, HB_COMP_PARAM ) ); + hb_compGenBreak( HB_COMP_PARAM ); HB_COMP_EXPR_FREE( hb_compExprGenPush( $3, HB_COMP_PARAM ) ); hb_compGenPCode2( HB_P_DOSHORT, 1, HB_COMP_PARAM ); HB_COMP_PARAM->functions.pLast->funFlags |= FUN_BREAK_CODE; } @@ -410,7 +410,7 @@ Statement : ExecFlow CrlfStmnt hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_EXIT_IN_SEQUENCE, "RETURN", NULL ); } /* TODO: check if return value agree with declared value */ - HB_COMP_EXPR_DELETE( hb_compExprGenPush( $3, HB_COMP_PARAM ) ); + HB_COMP_EXPR_FREE( hb_compExprGenPush( $3, HB_COMP_PARAM ) ); if( HB_COMP_PARAM->functions.pLast->funFlags & FUN_EXTBLOCK ) /* extended clodeblock, use HB_P_ENDBLOCK to return value and stop execution */ hb_compGenPCode1( HB_P_ENDBLOCK, HB_COMP_PARAM ); @@ -682,20 +682,20 @@ FieldAlias : FIELD ALIASOP { $$ = hb_compExprNewAlias( "FIELD", H /* ignore _FIELD-> or FIELD-> if a real alias is specified */ -FieldVarAlias : FieldAlias VarAlias { HB_COMP_EXPR_DELETE( $1 ); $$ = $2; } - | FieldAlias NumAlias { HB_COMP_EXPR_DELETE( $1 ); $$ = $2; } - | FieldAlias PareExpListAlias { HB_COMP_EXPR_DELETE( $1 ); $$ = $2; } - | FieldAlias MacroVarAlias { HB_COMP_EXPR_DELETE( $1 ); $$ = $2; } - | FieldAlias MacroExprAlias { HB_COMP_EXPR_DELETE( $1 ); $$ = $2; } - | FieldAlias NilAlias { HB_COMP_EXPR_DELETE( $1 ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $2 ); } - | FieldAlias LiteralAlias { HB_COMP_EXPR_DELETE( $1 ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $2 ); } - | FieldAlias LogicalAlias { HB_COMP_EXPR_DELETE( $1 ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $2 ); } - | FieldAlias CodeBlockAlias { HB_COMP_EXPR_DELETE( $1 ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $2 ); } - | FieldAlias SelfAlias { HB_COMP_EXPR_DELETE( $1 ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $2 ); } - | FieldAlias ArrayAlias { HB_COMP_EXPR_DELETE( $1 ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $2 ); } - | FieldAlias ArrayAtAlias { HB_COMP_EXPR_DELETE( $1 ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $2 ); } - | FieldAlias HashAlias { HB_COMP_EXPR_DELETE( $1 ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $2 ); } - | FieldAlias IfInlineAlias { HB_COMP_EXPR_DELETE( $1 ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $2 ); } +FieldVarAlias : FieldAlias VarAlias { HB_COMP_EXPR_FREE( $1 ); $$ = $2; } + | FieldAlias NumAlias { HB_COMP_EXPR_FREE( $1 ); $$ = $2; } + | FieldAlias PareExpListAlias { HB_COMP_EXPR_FREE( $1 ); $$ = $2; } + | FieldAlias MacroVarAlias { HB_COMP_EXPR_FREE( $1 ); $$ = $2; } + | FieldAlias MacroExprAlias { HB_COMP_EXPR_FREE( $1 ); $$ = $2; } + | FieldAlias NilAlias { HB_COMP_EXPR_FREE( $1 ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $2 ); } + | FieldAlias LiteralAlias { HB_COMP_EXPR_FREE( $1 ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $2 ); } + | FieldAlias LogicalAlias { HB_COMP_EXPR_FREE( $1 ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $2 ); } + | FieldAlias CodeBlockAlias { HB_COMP_EXPR_FREE( $1 ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $2 ); } + | FieldAlias SelfAlias { HB_COMP_EXPR_FREE( $1 ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $2 ); } + | FieldAlias ArrayAlias { HB_COMP_EXPR_FREE( $1 ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $2 ); } + | FieldAlias ArrayAtAlias { HB_COMP_EXPR_FREE( $1 ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $2 ); } + | FieldAlias HashAlias { HB_COMP_EXPR_FREE( $1 ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $2 ); } + | FieldAlias IfInlineAlias { HB_COMP_EXPR_FREE( $1 ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $2 ); } ; AliasId : IdentName { $$ = hb_compExprNewVar( $1, HB_COMP_PARAM ); } @@ -706,19 +706,19 @@ AliasVar : NumAlias AliasId { $$ = hb_compExprNewAliasVar( $1, $2, HB | MacroVarAlias AliasId { $$ = hb_compExprNewAliasVar( $1, $2, HB_COMP_PARAM ); } | MacroExprAlias AliasId { $$ = hb_compExprNewAliasVar( $1, $2, HB_COMP_PARAM ); } | PareExpListAlias AliasId { $$ = hb_compExprNewAliasVar( $1, $2, HB_COMP_PARAM ); } - | NilAlias AliasId { HB_COMP_EXPR_DELETE( $2 ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $1 ); } - | LiteralAlias AliasId { HB_COMP_EXPR_DELETE( $2 ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $1 ); } - | LogicalAlias AliasId { HB_COMP_EXPR_DELETE( $2 ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $1 ); } - | CodeBlockAlias AliasId { HB_COMP_EXPR_DELETE( $2 ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $1 ); } - | HashAlias AliasId { HB_COMP_EXPR_DELETE( $2 ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $1 ); } - | SelfAlias AliasId { HB_COMP_EXPR_DELETE( $2 ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $1 ); } - | ArrayAlias AliasId { HB_COMP_EXPR_DELETE( $2 ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $1 ); } - | ArrayAtAlias AliasId { HB_COMP_EXPR_DELETE( $2 ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $1 ); } /* QUESTION: Clipper reports error here - we can handle this */ - | VariableAtAlias AliasId { HB_COMP_EXPR_DELETE( $2 ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $1 ); } /* QUESTION: Clipper reports error here - we can handle this */ - | IfInlineAlias AliasId { HB_COMP_EXPR_DELETE( $2 ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $1 ); } /* QUESTION: Clipper reports error here - we can handle this */ - | FunCallAlias AliasId { HB_COMP_EXPR_DELETE( $2 ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $1 ); } /* QUESTION: Clipper reports error here - we can handle this */ - | ObjectDataAlias AliasId { HB_COMP_EXPR_DELETE( $2 ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $1 ); } /* QUESTION: Clipper reports error here - we can handle this */ - | ObjectMethodAlias AliasId { HB_COMP_EXPR_DELETE( $2 ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $1 ); } /* QUESTION: Clipper reports error here - we can handle this */ + | NilAlias AliasId { HB_COMP_EXPR_FREE( $2 ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $1 ); } + | LiteralAlias AliasId { HB_COMP_EXPR_FREE( $2 ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $1 ); } + | LogicalAlias AliasId { HB_COMP_EXPR_FREE( $2 ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $1 ); } + | CodeBlockAlias AliasId { HB_COMP_EXPR_FREE( $2 ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $1 ); } + | HashAlias AliasId { HB_COMP_EXPR_FREE( $2 ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $1 ); } + | SelfAlias AliasId { HB_COMP_EXPR_FREE( $2 ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $1 ); } + | ArrayAlias AliasId { HB_COMP_EXPR_FREE( $2 ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $1 ); } + | ArrayAtAlias AliasId { HB_COMP_EXPR_FREE( $2 ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $1 ); } /* QUESTION: Clipper reports error here - we can handle this */ + | VariableAtAlias AliasId { HB_COMP_EXPR_FREE( $2 ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $1 ); } /* QUESTION: Clipper reports error here - we can handle this */ + | IfInlineAlias AliasId { HB_COMP_EXPR_FREE( $2 ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $1 ); } /* QUESTION: Clipper reports error here - we can handle this */ + | FunCallAlias AliasId { HB_COMP_EXPR_FREE( $2 ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $1 ); } /* QUESTION: Clipper reports error here - we can handle this */ + | ObjectDataAlias AliasId { HB_COMP_EXPR_FREE( $2 ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $1 ); } /* QUESTION: Clipper reports error here - we can handle this */ + | ObjectMethodAlias AliasId { HB_COMP_EXPR_FREE( $2 ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $1 ); } /* QUESTION: Clipper reports error here - we can handle this */ | VarAlias AliasId { $$ = hb_compExprNewAliasVar( $1, $2, HB_COMP_PARAM ); } | FieldAlias AliasId { $$ = hb_compExprNewAliasVar( $1, $2, HB_COMP_PARAM ); } | FieldVarAlias AliasId { $$ = hb_compExprNewAliasVar( $1, $2, HB_COMP_PARAM ); } @@ -735,7 +735,7 @@ AliasExpr : NumAlias PareExpList { $$ = hb_compExprNewAliasExpr( $1, $2 | MacroVarAlias PareExpList { $$ = hb_compExprNewAliasExpr( $1, $2, HB_COMP_PARAM ); } | MacroExprAlias PareExpList { $$ = hb_compExprNewAliasExpr( $1, $2, HB_COMP_PARAM ); } | PareExpListAlias PareExpList { $$ = hb_compExprNewAliasExpr( $1, $2, HB_COMP_PARAM ); } - | FieldAlias PareExpList { HB_COMP_EXPR_DELETE( $1 ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $2 ); } /* QUESTION: Clipper reports error here - we can handle it */ + | FieldAlias PareExpList { HB_COMP_EXPR_FREE( $1 ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $2 ); } /* QUESTION: Clipper reports error here - we can handle it */ ; /* Array expressions access @@ -1123,12 +1123,12 @@ ExtVarDef : VarDef | MacroVar AsType { hb_compRTVariableAdd( HB_COMP_PARAM, hb_compExprNewRTVar( NULL, $1, HB_COMP_PARAM ), HB_FALSE ); } | MacroVar AsType INASSIGN Expression - { HB_COMP_EXPR_DELETE( hb_compExprGenPush( $4, HB_COMP_PARAM ) ); + { HB_COMP_EXPR_FREE( hb_compExprGenPush( $4, HB_COMP_PARAM ) ); hb_compRTVariableAdd( HB_COMP_PARAM, hb_compExprNewRTVar( NULL, $1, HB_COMP_PARAM ), HB_TRUE ); } | MacroVar DimList AsArrayType { - HB_COMP_EXPR_DELETE( hb_compArrayDimPush( $2, HB_COMP_PARAM ) ); + HB_COMP_EXPR_FREE( hb_compArrayDimPush( $2, HB_COMP_PARAM ) ); hb_compRTVariableAdd( HB_COMP_PARAM, hb_compExprNewRTVar( NULL, $1, HB_COMP_PARAM ), HB_TRUE ); } ; @@ -1148,7 +1148,7 @@ VarDef : IdentName AsType else if( HB_COMP_PARAM->iVarScope == VS_LOCAL && ( HB_COMP_PARAM->functions.pLast->funFlags & FUN_EXTBLOCK ) ) { - HB_COMP_EXPR_DELETE( hb_compExprGenPush( hb_compExprNewNil( HB_COMP_PARAM ), HB_COMP_PARAM ) ); + HB_COMP_EXPR_FREE( hb_compExprGenPush( hb_compExprNewNil( HB_COMP_PARAM ), HB_COMP_PARAM ) ); } } | IdentName AsType { $$ = HB_COMP_PARAM->iVarScope; @@ -1160,22 +1160,22 @@ VarDef : IdentName AsType if( HB_COMP_PARAM->iVarScope & VS_STATIC ) { hb_compStaticDefStart( HB_COMP_PARAM ); /* switch to statics pcode buffer */ - HB_COMP_EXPR_DELETE( hb_compExprGenStatement( hb_compExprAssignStatic( hb_compExprNewVar( $1, HB_COMP_PARAM ), $5, HB_COMP_PARAM ), HB_COMP_PARAM ) ); + HB_COMP_EXPR_FREE( hb_compExprGenStatement( hb_compExprAssignStatic( hb_compExprNewVar( $1, HB_COMP_PARAM ), $5, HB_COMP_PARAM ), HB_COMP_PARAM ) ); hb_compStaticDefEnd( HB_COMP_PARAM, $1 ); } else if( HB_COMP_PARAM->iVarScope == VS_PUBLIC || HB_COMP_PARAM->iVarScope == VS_PRIVATE ) { - HB_COMP_EXPR_DELETE( hb_compExprGenPush( $5, HB_COMP_PARAM ) ); + HB_COMP_EXPR_FREE( hb_compExprGenPush( $5, HB_COMP_PARAM ) ); hb_compRTVariableAdd( HB_COMP_PARAM, hb_compExprNewRTVar( $1, NULL, HB_COMP_PARAM ), HB_TRUE ); } else if( HB_COMP_PARAM->iVarScope == VS_LOCAL && ( HB_COMP_PARAM->functions.pLast->funFlags & FUN_EXTBLOCK ) ) { - HB_COMP_EXPR_DELETE( hb_compExprGenPush( $5, HB_COMP_PARAM ) ); + HB_COMP_EXPR_FREE( hb_compExprGenPush( $5, HB_COMP_PARAM ) ); } else { - HB_COMP_EXPR_DELETE( hb_compExprGenStatement( hb_compExprAssign( hb_compExprNewVar( $1, HB_COMP_PARAM ), $5, HB_COMP_PARAM ), HB_COMP_PARAM ) ); + HB_COMP_EXPR_FREE( hb_compExprGenStatement( hb_compExprAssign( hb_compExprNewVar( $1, HB_COMP_PARAM ), $5, HB_COMP_PARAM ), HB_COMP_PARAM ) ); } HB_COMP_PARAM->iVarScope = $3; } @@ -1345,7 +1345,7 @@ DummyArgList : DummyArgument | DummyArgList ',' DummyArgument ; -DummyArgument : EmptyExpression { HB_COMP_EXPR_DELETE( $1 ); } +DummyArgument : EmptyExpression { HB_COMP_EXPR_FREE( $1 ); } ; FormalList : IdentName AsType { hb_compDeclaredParameterAdd( HB_COMP_PARAM, $1, $2 ); } @@ -1383,7 +1383,7 @@ IfEndif : IfBegin EndIf { hb_compGenJumpHere( $1, HB_COMP_ IfBegin : IF ExpList { ++HB_COMP_PARAM->functions.pLast->wIfCounter; hb_compLinePushIfInside( HB_COMP_PARAM ); } Crlf - { HB_COMP_EXPR_DELETE( hb_compExprGenPush( $2, HB_COMP_PARAM ) ); $$ = hb_compGenJumpFalse( 0, HB_COMP_PARAM ); } + { HB_COMP_EXPR_FREE( hb_compExprGenPush( $2, HB_COMP_PARAM ) ); $$ = hb_compGenJumpFalse( 0, HB_COMP_PARAM ); } EmptyStats { $$ = hb_compGenJump( 0, HB_COMP_PARAM ); hb_compGenJumpHere( $5, HB_COMP_PARAM ); } ; @@ -1394,7 +1394,7 @@ IfElse : ELSE Crlf { HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_BREAK IfElseIf : ELSEIF { HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_BREAK_CODE; hb_compLinePush( HB_COMP_PARAM ); } ExpList Crlf - { HB_COMP_EXPR_DELETE( hb_compExprGenPush( $3, HB_COMP_PARAM ) ); + { HB_COMP_EXPR_FREE( hb_compExprGenPush( $3, HB_COMP_PARAM ) ); $$ = hb_compGenJumpFalse( 0, HB_COMP_PARAM ); } EmptyStats @@ -1404,7 +1404,7 @@ IfElseIf : ELSEIF { HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_BREAK_CO | IfElseIf ELSEIF { HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_BREAK_CODE; hb_compLinePush( HB_COMP_PARAM ); } ExpList Crlf - { HB_COMP_EXPR_DELETE( hb_compExprGenPush( $4, HB_COMP_PARAM ) ); + { HB_COMP_EXPR_FREE( hb_compExprGenPush( $4, HB_COMP_PARAM ) ); $$ = hb_compGenJumpFalse( 0, HB_COMP_PARAM ); } EmptyStats @@ -1467,7 +1467,7 @@ DoCaseBegin : DoCaseStart Cases : CASE { hb_compLinePushIfInside( HB_COMP_PARAM ); } ExpList Crlf { - HB_COMP_EXPR_DELETE( hb_compExprGenPush( $3, HB_COMP_PARAM ) ); + HB_COMP_EXPR_FREE( hb_compExprGenPush( $3, HB_COMP_PARAM ) ); $$ = hb_compGenJumpFalse( 0, HB_COMP_PARAM ); } EmptyStats @@ -1479,7 +1479,7 @@ Cases : CASE { hb_compLinePushIfInside( HB_COMP_PARAM ); } ExpList Crlf | Cases CASE { hb_compLinePushIfInside( HB_COMP_PARAM ); } ExpList Crlf { - HB_COMP_EXPR_DELETE( hb_compExprGenPush( $4, HB_COMP_PARAM ) ); + HB_COMP_EXPR_FREE( hb_compExprGenPush( $4, HB_COMP_PARAM ) ); $$ = hb_compGenJumpFalse( 0, HB_COMP_PARAM ); } EmptyStats @@ -1498,7 +1498,7 @@ Otherwise : OTHERWISE {hb_compLinePushIfDebugger( HB_COMP_PARAM ); } Crlf { HB_ DoWhile : WhileBegin ExpList Crlf { - HB_COMP_EXPR_DELETE( hb_compExprGenPush( $2, HB_COMP_PARAM ) ); + HB_COMP_EXPR_FREE( hb_compExprGenPush( $2, HB_COMP_PARAM ) ); $$ = hb_compGenJumpFalse( 0, HB_COMP_PARAM ); } EmptyStats @@ -1578,16 +1578,16 @@ ForNext : FOR LValue ForAssign Expression /* 1 2 3 4 */ HB_COMP_EXPR_CLEAR( hb_compExprGenPush( hb_compExprNewPreInc( $2, HB_COMP_PARAM ), HB_COMP_PARAM ) ); } hb_compGenJumpHere( ( HB_ULONG ) $9, HB_COMP_PARAM ); - HB_COMP_EXPR_DELETE( hb_compExprGenPush( $7, HB_COMP_PARAM ) ); /* end */ + HB_COMP_EXPR_FREE( hb_compExprGenPush( $7, HB_COMP_PARAM ) ); /* end */ if( iSign ) { hb_compGenPCode1( ( HB_BYTE ) ( iSign > 0 ? HB_P_GREATER : HB_P_LESS ), HB_COMP_PARAM ); if( $8 ) - HB_COMP_EXPR_DELETE( $8 ); + HB_COMP_EXPR_FREE( $8 ); } else { - HB_COMP_EXPR_DELETE( hb_compExprGenPush( $8, HB_COMP_PARAM ) ); /* step */ + HB_COMP_EXPR_FREE( hb_compExprGenPush( $8, HB_COMP_PARAM ) ); /* step */ hb_compGenPCode1( HB_P_FORTEST, HB_COMP_PARAM ); } @@ -1595,7 +1595,7 @@ ForNext : FOR LValue ForAssign Expression /* 1 2 3 4 */ hb_compLoopEnd( HB_COMP_PARAM ); if( hb_compExprAsSymbol( $2 ) ) hb_compForEnd( HB_COMP_PARAM, hb_compExprAsSymbol( $2 ) ); - HB_COMP_EXPR_DELETE( $5 ); /* deletes $5, $2, $4 */ + HB_COMP_EXPR_FREE( $5 ); /* deletes $5, $2, $4 */ HB_COMP_PARAM->functions.pLast->funFlags &= ~ ( FUN_WITH_RETURN | FUN_BREAK_CODE ); } ; @@ -1672,8 +1672,8 @@ ForEach : FOREACH ForList IN ForArgs /* 1 2 3 4 */ hb_compLoopEnd( HB_COMP_PARAM ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ ( FUN_WITH_RETURN | FUN_BREAK_CODE ); hb_compEnumEnd( HB_COMP_PARAM, $2 ); - HB_COMP_EXPR_DELETE( $2 ); - HB_COMP_EXPR_DELETE( $4 ); + HB_COMP_EXPR_FREE( $2 ); + HB_COMP_EXPR_FREE( $4 ); } ; @@ -1697,7 +1697,7 @@ DoSwitch : SwitchBegin | SwitchBegin EndSwitch { - HB_COMP_EXPR_DELETE( $1 ); + HB_COMP_EXPR_FREE( $1 ); hb_compGenPCode1( HB_P_POP, HB_COMP_PARAM ); } ; @@ -1818,7 +1818,7 @@ EndSeqID : ENDSEQ BlockSeq : /* no always */ { $$ = 0; } | WITH Expression { - HB_COMP_EXPR_DELETE( hb_compExprGenPush( $2, HB_COMP_PARAM ) ); + HB_COMP_EXPR_FREE( hb_compExprGenPush( $2, HB_COMP_PARAM ) ); hb_compGenPCode1( HB_P_SEQBLOCK, HB_COMP_PARAM ); $$ = HB_COMP_PARAM->functions.pLast->lPCodePos; } @@ -1904,7 +1904,7 @@ DoArgument : IdentName { $$ = hb_compExprNewVarRef( $1, HB_COMP_PARAM ); WithObject : WITHOBJECT Expression Crlf { hb_compLinePushIfInside( HB_COMP_PARAM ); - HB_COMP_EXPR_DELETE( hb_compExprGenPush( $2, HB_COMP_PARAM ) ); + HB_COMP_EXPR_FREE( hb_compExprGenPush( $2, HB_COMP_PARAM ) ); $$ = HB_COMP_PARAM->functions.pLast->lPCodePos; hb_compGenPCode1( HB_P_WITHOBJECTSTART, HB_COMP_PARAM ); HB_COMP_PARAM->functions.pLast->wWithObjectCnt++; @@ -2330,9 +2330,9 @@ static void hb_compRTVariableGen( HB_COMP_DECL, const char * szCreateFun ) while( pVar ) { if( pVar->bPopValue ) - HB_COMP_EXPR_DELETE( hb_compExprGenPop( pVar->pVar, HB_COMP_PARAM ) ); + HB_COMP_EXPR_FREE( hb_compExprGenPop( pVar->pVar, HB_COMP_PARAM ) ); else - HB_COMP_EXPR_DELETE( pVar->pVar ); + HB_COMP_EXPR_FREE( pVar->pVar ); pDel = pVar; pVar = pVar->pPrev; hb_xfree( pDel ); @@ -2348,7 +2348,7 @@ void hb_compRTVariableKill( HB_COMP_DECL, PFUNCTION pFunc ) { pVar = pFunc->rtvars; - HB_COMP_EXPR_DELETE( pVar->pVar ); + HB_COMP_EXPR_FREE( pVar->pVar ); pFunc->rtvars = pVar->pPrev; hb_xfree( pVar ); } @@ -2377,7 +2377,7 @@ static void hb_compVariableDim( const char * szName, HB_EXPR_PTR pInitValue, HB_ if( HB_COMP_PARAM->iVarScope == VS_PUBLIC || HB_COMP_PARAM->iVarScope == VS_PRIVATE ) { hb_compVariableAdd( HB_COMP_PARAM, szName, hb_compVarTypeNew( HB_COMP_PARAM, 'A', NULL ) ); - HB_COMP_EXPR_DELETE( hb_compArrayDimPush( pInitValue, HB_COMP_PARAM ) ); + HB_COMP_EXPR_FREE( hb_compArrayDimPush( pInitValue, HB_COMP_PARAM ) ); hb_compRTVariableAdd( HB_COMP_PARAM, hb_compExprNewRTVar( szName, NULL, HB_COMP_PARAM ), HB_TRUE ); } else if( HB_COMP_PARAM->iVarScope & VS_STATIC ) @@ -2396,17 +2396,17 @@ static void hb_compVariableDim( const char * szName, HB_EXPR_PTR pInitValue, HB_ /* check if valid initializers were used but don't generate any code */ pAssign = hb_compExprAssignStatic( pVar, pInitValue, HB_COMP_PARAM ); /* delete all used expressions */ - HB_COMP_EXPR_DELETE( pAssign ); + HB_COMP_EXPR_FREE( pAssign ); hb_compStaticDefEnd( HB_COMP_PARAM, szName ); } else { hb_compVariableAdd( HB_COMP_PARAM, szName, hb_compVarTypeNew( HB_COMP_PARAM, 'A', NULL ) ); - HB_COMP_EXPR_DELETE( hb_compArrayDimPush( pInitValue, HB_COMP_PARAM ) ); + HB_COMP_EXPR_FREE( hb_compArrayDimPush( pInitValue, HB_COMP_PARAM ) ); if( HB_COMP_PARAM->iVarScope != VS_LOCAL || !( HB_COMP_PARAM->functions.pLast->funFlags & FUN_EXTBLOCK ) ) { - HB_COMP_EXPR_DELETE( hb_compExprGenPop( hb_compExprNewVar( szName, HB_COMP_PARAM ), HB_COMP_PARAM ) ); + HB_COMP_EXPR_FREE( hb_compExprGenPop( hb_compExprNewVar( szName, HB_COMP_PARAM ), HB_COMP_PARAM ) ); } } } @@ -2699,12 +2699,12 @@ static void hb_compSwitchEnd( HB_COMP_DECL ) hb_compGenJumpHere( ulExitPos, HB_COMP_PARAM ); if( pExpr ) - HB_COMP_EXPR_DELETE( pExpr ); + HB_COMP_EXPR_FREE( pExpr ); pCase = pSwitch->pCases; while( pCase ) { - HB_COMP_EXPR_DELETE( pCase->pExpr ); + HB_COMP_EXPR_FREE( pCase->pExpr ); pTmp = pCase->pNext; hb_xfree( (void *)pCase ); pCase = pTmp; @@ -2725,14 +2725,14 @@ void hb_compSwitchKill( HB_COMP_DECL, PFUNCTION pFunc ) while( pFunc->pSwitch->pCases ) { pCase = pFunc->pSwitch->pCases; - HB_COMP_EXPR_DELETE( pCase->pExpr ); + HB_COMP_EXPR_FREE( pCase->pExpr ); pFunc->pSwitch->pCases = pCase->pNext; hb_xfree( (void *) pCase ); } pSwitch = pFunc->pSwitch; pFunc->pSwitch = pSwitch->pPrev; if( pSwitch->pExpr ) - HB_COMP_EXPR_DELETE( pSwitch->pExpr ); + HB_COMP_EXPR_FREE( pSwitch->pExpr ); hb_xfree( (void *) pSwitch ); } } @@ -2752,7 +2752,7 @@ static HB_EXPR_PTR hb_compCheckPassByRef( HB_COMP_DECL, HB_EXPR_PTR pExpr ) else { pExpr = hb_compExprNewFunRef( hb_compExprAsSymbol( pExpr ), HB_COMP_PARAM ); - HB_COMP_EXPR_DELETE( pDelExpr ); + HB_COMP_EXPR_FREE( pDelExpr ); } return pExpr; } diff --git a/harbour/src/compiler/harbour.yyc b/harbour/src/compiler/harbour.yyc index f1fa39f314..4c67180697 100644 --- a/harbour/src/compiler/harbour.yyc +++ b/harbour/src/compiler/harbour.yyc @@ -4519,67 +4519,67 @@ yyreduce: case 59: #line 366 "harbour.y" - { HB_COMP_EXPR_DELETE( hb_compExprGenStatement( (yyvsp[(1) - (2)].asExpr), HB_COMP_PARAM ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; ;} + { HB_COMP_EXPR_FREE( hb_compExprGenStatement( (yyvsp[(1) - (2)].asExpr), HB_COMP_PARAM ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; ;} break; case 60: #line 367 "harbour.y" - { HB_COMP_EXPR_DELETE( hb_compExprGenStatement( (yyvsp[(1) - (2)].asExpr), HB_COMP_PARAM ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; ;} + { HB_COMP_EXPR_FREE( hb_compExprGenStatement( (yyvsp[(1) - (2)].asExpr), HB_COMP_PARAM ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; ;} break; case 61: #line 368 "harbour.y" - { HB_COMP_EXPR_DELETE( hb_compExprGenStatement( (yyvsp[(1) - (2)].asExpr), HB_COMP_PARAM ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; ;} + { HB_COMP_EXPR_FREE( hb_compExprGenStatement( (yyvsp[(1) - (2)].asExpr), HB_COMP_PARAM ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; ;} break; case 62: #line 369 "harbour.y" - { HB_COMP_EXPR_DELETE( hb_compExprGenStatement( (yyvsp[(1) - (2)].asExpr), HB_COMP_PARAM ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; ;} + { HB_COMP_EXPR_FREE( hb_compExprGenStatement( (yyvsp[(1) - (2)].asExpr), HB_COMP_PARAM ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; ;} break; case 63: #line 370 "harbour.y" { if( HB_COMP_ISSUPPORTED( HB_COMPFLAG_XBASE ) ) - HB_COMP_EXPR_DELETE( hb_compExprGenStatement( (yyvsp[(1) - (2)].asExpr), HB_COMP_PARAM ) ); + HB_COMP_EXPR_FREE( hb_compExprGenStatement( (yyvsp[(1) - (2)].asExpr), HB_COMP_PARAM ) ); else - HB_COMP_EXPR_DELETE( HB_COMP_ERROR_SYNTAX( (yyvsp[(1) - (2)].asExpr) ) ); + HB_COMP_EXPR_FREE( HB_COMP_ERROR_SYNTAX( (yyvsp[(1) - (2)].asExpr) ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; ;} break; case 64: #line 376 "harbour.y" - { HB_COMP_EXPR_DELETE( hb_compExprGenStatement( (yyvsp[(1) - (2)].asExpr), HB_COMP_PARAM ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; ;} + { HB_COMP_EXPR_FREE( hb_compExprGenStatement( (yyvsp[(1) - (2)].asExpr), HB_COMP_PARAM ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; ;} break; case 65: #line 377 "harbour.y" - { HB_COMP_EXPR_DELETE( hb_compExprGenStatement( (yyvsp[(1) - (2)].asExpr), HB_COMP_PARAM ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; ;} + { HB_COMP_EXPR_FREE( hb_compExprGenStatement( (yyvsp[(1) - (2)].asExpr), HB_COMP_PARAM ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; ;} break; case 66: #line 378 "harbour.y" - { HB_COMP_EXPR_DELETE( hb_compExprGenStatement( (yyvsp[(1) - (2)].asExpr), HB_COMP_PARAM ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; ;} + { HB_COMP_EXPR_FREE( hb_compExprGenStatement( (yyvsp[(1) - (2)].asExpr), HB_COMP_PARAM ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; ;} break; case 67: #line 379 "harbour.y" - { HB_COMP_EXPR_DELETE( hb_compExprGenStatement( (yyvsp[(1) - (2)].asExpr), HB_COMP_PARAM ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; ;} + { HB_COMP_EXPR_FREE( hb_compExprGenStatement( (yyvsp[(1) - (2)].asExpr), HB_COMP_PARAM ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; ;} break; case 68: #line 380 "harbour.y" - { HB_COMP_EXPR_DELETE( hb_compExprGenStatement( (yyvsp[(1) - (2)].asExpr), HB_COMP_PARAM ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; ;} + { HB_COMP_EXPR_FREE( hb_compExprGenStatement( (yyvsp[(1) - (2)].asExpr), HB_COMP_PARAM ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; ;} break; case 69: #line 381 "harbour.y" - { HB_COMP_EXPR_DELETE( hb_compExprGenStatement( (yyvsp[(1) - (2)].asExpr), HB_COMP_PARAM ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; ;} + { HB_COMP_EXPR_FREE( hb_compExprGenStatement( (yyvsp[(1) - (2)].asExpr), HB_COMP_PARAM ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; ;} break; case 70: #line 382 "harbour.y" - { HB_COMP_EXPR_DELETE( hb_compExprGenStatement( (yyvsp[(1) - (2)].asExpr), HB_COMP_PARAM ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; ;} + { HB_COMP_EXPR_FREE( hb_compExprGenStatement( (yyvsp[(1) - (2)].asExpr), HB_COMP_PARAM ) ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ FUN_WITH_RETURN; ;} break; case 71: @@ -4596,7 +4596,7 @@ yyreduce: case 73: #line 386 "harbour.y" { - hb_compGenBreak( HB_COMP_PARAM ); HB_COMP_EXPR_DELETE( hb_compExprGenPush( (yyvsp[(3) - (4)].asExpr), HB_COMP_PARAM ) ); + hb_compGenBreak( HB_COMP_PARAM ); HB_COMP_EXPR_FREE( hb_compExprGenPush( (yyvsp[(3) - (4)].asExpr), HB_COMP_PARAM ) ); hb_compGenPCode2( HB_P_DOSHORT, 1, HB_COMP_PARAM ); HB_COMP_PARAM->functions.pLast->funFlags |= FUN_BREAK_CODE; ;} @@ -4641,7 +4641,7 @@ yyreduce: hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_EXIT_IN_SEQUENCE, "RETURN", NULL ); } /* TODO: check if return value agree with declared value */ - HB_COMP_EXPR_DELETE( hb_compExprGenPush( (yyvsp[(3) - (4)].asExpr), HB_COMP_PARAM ) ); + HB_COMP_EXPR_FREE( hb_compExprGenPush( (yyvsp[(3) - (4)].asExpr), HB_COMP_PARAM ) ); if( HB_COMP_PARAM->functions.pLast->funFlags & FUN_EXTBLOCK ) /* extended clodeblock, use HB_P_ENDBLOCK to return value and stop execution */ hb_compGenPCode1( HB_P_ENDBLOCK, HB_COMP_PARAM ); @@ -5022,72 +5022,72 @@ yyreduce: case 174: #line 685 "harbour.y" - { HB_COMP_EXPR_DELETE( (yyvsp[(1) - (2)].asExpr) ); (yyval.asExpr) = (yyvsp[(2) - (2)].asExpr); ;} + { HB_COMP_EXPR_FREE( (yyvsp[(1) - (2)].asExpr) ); (yyval.asExpr) = (yyvsp[(2) - (2)].asExpr); ;} break; case 175: #line 686 "harbour.y" - { HB_COMP_EXPR_DELETE( (yyvsp[(1) - (2)].asExpr) ); (yyval.asExpr) = (yyvsp[(2) - (2)].asExpr); ;} + { HB_COMP_EXPR_FREE( (yyvsp[(1) - (2)].asExpr) ); (yyval.asExpr) = (yyvsp[(2) - (2)].asExpr); ;} break; case 176: #line 687 "harbour.y" - { HB_COMP_EXPR_DELETE( (yyvsp[(1) - (2)].asExpr) ); (yyval.asExpr) = (yyvsp[(2) - (2)].asExpr); ;} + { HB_COMP_EXPR_FREE( (yyvsp[(1) - (2)].asExpr) ); (yyval.asExpr) = (yyvsp[(2) - (2)].asExpr); ;} break; case 177: #line 688 "harbour.y" - { HB_COMP_EXPR_DELETE( (yyvsp[(1) - (2)].asExpr) ); (yyval.asExpr) = (yyvsp[(2) - (2)].asExpr); ;} + { HB_COMP_EXPR_FREE( (yyvsp[(1) - (2)].asExpr) ); (yyval.asExpr) = (yyvsp[(2) - (2)].asExpr); ;} break; case 178: #line 689 "harbour.y" - { HB_COMP_EXPR_DELETE( (yyvsp[(1) - (2)].asExpr) ); (yyval.asExpr) = (yyvsp[(2) - (2)].asExpr); ;} + { HB_COMP_EXPR_FREE( (yyvsp[(1) - (2)].asExpr) ); (yyval.asExpr) = (yyvsp[(2) - (2)].asExpr); ;} break; case 179: #line 690 "harbour.y" - { HB_COMP_EXPR_DELETE( (yyvsp[(1) - (2)].asExpr) ); (yyval.asExpr) = hb_compErrorAlias( HB_COMP_PARAM, (yyvsp[(2) - (2)].asExpr) ); ;} + { HB_COMP_EXPR_FREE( (yyvsp[(1) - (2)].asExpr) ); (yyval.asExpr) = hb_compErrorAlias( HB_COMP_PARAM, (yyvsp[(2) - (2)].asExpr) ); ;} break; case 180: #line 691 "harbour.y" - { HB_COMP_EXPR_DELETE( (yyvsp[(1) - (2)].asExpr) ); (yyval.asExpr) = hb_compErrorAlias( HB_COMP_PARAM, (yyvsp[(2) - (2)].asExpr) ); ;} + { HB_COMP_EXPR_FREE( (yyvsp[(1) - (2)].asExpr) ); (yyval.asExpr) = hb_compErrorAlias( HB_COMP_PARAM, (yyvsp[(2) - (2)].asExpr) ); ;} break; case 181: #line 692 "harbour.y" - { HB_COMP_EXPR_DELETE( (yyvsp[(1) - (2)].asExpr) ); (yyval.asExpr) = hb_compErrorAlias( HB_COMP_PARAM, (yyvsp[(2) - (2)].asExpr) ); ;} + { HB_COMP_EXPR_FREE( (yyvsp[(1) - (2)].asExpr) ); (yyval.asExpr) = hb_compErrorAlias( HB_COMP_PARAM, (yyvsp[(2) - (2)].asExpr) ); ;} break; case 182: #line 693 "harbour.y" - { HB_COMP_EXPR_DELETE( (yyvsp[(1) - (2)].asExpr) ); (yyval.asExpr) = hb_compErrorAlias( HB_COMP_PARAM, (yyvsp[(2) - (2)].asExpr) ); ;} + { HB_COMP_EXPR_FREE( (yyvsp[(1) - (2)].asExpr) ); (yyval.asExpr) = hb_compErrorAlias( HB_COMP_PARAM, (yyvsp[(2) - (2)].asExpr) ); ;} break; case 183: #line 694 "harbour.y" - { HB_COMP_EXPR_DELETE( (yyvsp[(1) - (2)].asExpr) ); (yyval.asExpr) = hb_compErrorAlias( HB_COMP_PARAM, (yyvsp[(2) - (2)].asExpr) ); ;} + { HB_COMP_EXPR_FREE( (yyvsp[(1) - (2)].asExpr) ); (yyval.asExpr) = hb_compErrorAlias( HB_COMP_PARAM, (yyvsp[(2) - (2)].asExpr) ); ;} break; case 184: #line 695 "harbour.y" - { HB_COMP_EXPR_DELETE( (yyvsp[(1) - (2)].asExpr) ); (yyval.asExpr) = hb_compErrorAlias( HB_COMP_PARAM, (yyvsp[(2) - (2)].asExpr) ); ;} + { HB_COMP_EXPR_FREE( (yyvsp[(1) - (2)].asExpr) ); (yyval.asExpr) = hb_compErrorAlias( HB_COMP_PARAM, (yyvsp[(2) - (2)].asExpr) ); ;} break; case 185: #line 696 "harbour.y" - { HB_COMP_EXPR_DELETE( (yyvsp[(1) - (2)].asExpr) ); (yyval.asExpr) = hb_compErrorAlias( HB_COMP_PARAM, (yyvsp[(2) - (2)].asExpr) ); ;} + { HB_COMP_EXPR_FREE( (yyvsp[(1) - (2)].asExpr) ); (yyval.asExpr) = hb_compErrorAlias( HB_COMP_PARAM, (yyvsp[(2) - (2)].asExpr) ); ;} break; case 186: #line 697 "harbour.y" - { HB_COMP_EXPR_DELETE( (yyvsp[(1) - (2)].asExpr) ); (yyval.asExpr) = hb_compErrorAlias( HB_COMP_PARAM, (yyvsp[(2) - (2)].asExpr) ); ;} + { HB_COMP_EXPR_FREE( (yyvsp[(1) - (2)].asExpr) ); (yyval.asExpr) = hb_compErrorAlias( HB_COMP_PARAM, (yyvsp[(2) - (2)].asExpr) ); ;} break; case 187: #line 698 "harbour.y" - { HB_COMP_EXPR_DELETE( (yyvsp[(1) - (2)].asExpr) ); (yyval.asExpr) = hb_compErrorAlias( HB_COMP_PARAM, (yyvsp[(2) - (2)].asExpr) ); ;} + { HB_COMP_EXPR_FREE( (yyvsp[(1) - (2)].asExpr) ); (yyval.asExpr) = hb_compErrorAlias( HB_COMP_PARAM, (yyvsp[(2) - (2)].asExpr) ); ;} break; case 188: @@ -5117,67 +5117,67 @@ yyreduce: case 194: #line 709 "harbour.y" - { HB_COMP_EXPR_DELETE( (yyvsp[(2) - (2)].asExpr) ); (yyval.asExpr) = hb_compErrorAlias( HB_COMP_PARAM, (yyvsp[(1) - (2)].asExpr) ); ;} + { HB_COMP_EXPR_FREE( (yyvsp[(2) - (2)].asExpr) ); (yyval.asExpr) = hb_compErrorAlias( HB_COMP_PARAM, (yyvsp[(1) - (2)].asExpr) ); ;} break; case 195: #line 710 "harbour.y" - { HB_COMP_EXPR_DELETE( (yyvsp[(2) - (2)].asExpr) ); (yyval.asExpr) = hb_compErrorAlias( HB_COMP_PARAM, (yyvsp[(1) - (2)].asExpr) ); ;} + { HB_COMP_EXPR_FREE( (yyvsp[(2) - (2)].asExpr) ); (yyval.asExpr) = hb_compErrorAlias( HB_COMP_PARAM, (yyvsp[(1) - (2)].asExpr) ); ;} break; case 196: #line 711 "harbour.y" - { HB_COMP_EXPR_DELETE( (yyvsp[(2) - (2)].asExpr) ); (yyval.asExpr) = hb_compErrorAlias( HB_COMP_PARAM, (yyvsp[(1) - (2)].asExpr) ); ;} + { HB_COMP_EXPR_FREE( (yyvsp[(2) - (2)].asExpr) ); (yyval.asExpr) = hb_compErrorAlias( HB_COMP_PARAM, (yyvsp[(1) - (2)].asExpr) ); ;} break; case 197: #line 712 "harbour.y" - { HB_COMP_EXPR_DELETE( (yyvsp[(2) - (2)].asExpr) ); (yyval.asExpr) = hb_compErrorAlias( HB_COMP_PARAM, (yyvsp[(1) - (2)].asExpr) ); ;} + { HB_COMP_EXPR_FREE( (yyvsp[(2) - (2)].asExpr) ); (yyval.asExpr) = hb_compErrorAlias( HB_COMP_PARAM, (yyvsp[(1) - (2)].asExpr) ); ;} break; case 198: #line 713 "harbour.y" - { HB_COMP_EXPR_DELETE( (yyvsp[(2) - (2)].asExpr) ); (yyval.asExpr) = hb_compErrorAlias( HB_COMP_PARAM, (yyvsp[(1) - (2)].asExpr) ); ;} + { HB_COMP_EXPR_FREE( (yyvsp[(2) - (2)].asExpr) ); (yyval.asExpr) = hb_compErrorAlias( HB_COMP_PARAM, (yyvsp[(1) - (2)].asExpr) ); ;} break; case 199: #line 714 "harbour.y" - { HB_COMP_EXPR_DELETE( (yyvsp[(2) - (2)].asExpr) ); (yyval.asExpr) = hb_compErrorAlias( HB_COMP_PARAM, (yyvsp[(1) - (2)].asExpr) ); ;} + { HB_COMP_EXPR_FREE( (yyvsp[(2) - (2)].asExpr) ); (yyval.asExpr) = hb_compErrorAlias( HB_COMP_PARAM, (yyvsp[(1) - (2)].asExpr) ); ;} break; case 200: #line 715 "harbour.y" - { HB_COMP_EXPR_DELETE( (yyvsp[(2) - (2)].asExpr) ); (yyval.asExpr) = hb_compErrorAlias( HB_COMP_PARAM, (yyvsp[(1) - (2)].asExpr) ); ;} + { HB_COMP_EXPR_FREE( (yyvsp[(2) - (2)].asExpr) ); (yyval.asExpr) = hb_compErrorAlias( HB_COMP_PARAM, (yyvsp[(1) - (2)].asExpr) ); ;} break; case 201: #line 716 "harbour.y" - { HB_COMP_EXPR_DELETE( (yyvsp[(2) - (2)].asExpr) ); (yyval.asExpr) = hb_compErrorAlias( HB_COMP_PARAM, (yyvsp[(1) - (2)].asExpr) ); ;} + { HB_COMP_EXPR_FREE( (yyvsp[(2) - (2)].asExpr) ); (yyval.asExpr) = hb_compErrorAlias( HB_COMP_PARAM, (yyvsp[(1) - (2)].asExpr) ); ;} break; case 202: #line 717 "harbour.y" - { HB_COMP_EXPR_DELETE( (yyvsp[(2) - (2)].asExpr) ); (yyval.asExpr) = hb_compErrorAlias( HB_COMP_PARAM, (yyvsp[(1) - (2)].asExpr) ); ;} + { HB_COMP_EXPR_FREE( (yyvsp[(2) - (2)].asExpr) ); (yyval.asExpr) = hb_compErrorAlias( HB_COMP_PARAM, (yyvsp[(1) - (2)].asExpr) ); ;} break; case 203: #line 718 "harbour.y" - { HB_COMP_EXPR_DELETE( (yyvsp[(2) - (2)].asExpr) ); (yyval.asExpr) = hb_compErrorAlias( HB_COMP_PARAM, (yyvsp[(1) - (2)].asExpr) ); ;} + { HB_COMP_EXPR_FREE( (yyvsp[(2) - (2)].asExpr) ); (yyval.asExpr) = hb_compErrorAlias( HB_COMP_PARAM, (yyvsp[(1) - (2)].asExpr) ); ;} break; case 204: #line 719 "harbour.y" - { HB_COMP_EXPR_DELETE( (yyvsp[(2) - (2)].asExpr) ); (yyval.asExpr) = hb_compErrorAlias( HB_COMP_PARAM, (yyvsp[(1) - (2)].asExpr) ); ;} + { HB_COMP_EXPR_FREE( (yyvsp[(2) - (2)].asExpr) ); (yyval.asExpr) = hb_compErrorAlias( HB_COMP_PARAM, (yyvsp[(1) - (2)].asExpr) ); ;} break; case 205: #line 720 "harbour.y" - { HB_COMP_EXPR_DELETE( (yyvsp[(2) - (2)].asExpr) ); (yyval.asExpr) = hb_compErrorAlias( HB_COMP_PARAM, (yyvsp[(1) - (2)].asExpr) ); ;} + { HB_COMP_EXPR_FREE( (yyvsp[(2) - (2)].asExpr) ); (yyval.asExpr) = hb_compErrorAlias( HB_COMP_PARAM, (yyvsp[(1) - (2)].asExpr) ); ;} break; case 206: #line 721 "harbour.y" - { HB_COMP_EXPR_DELETE( (yyvsp[(2) - (2)].asExpr) ); (yyval.asExpr) = hb_compErrorAlias( HB_COMP_PARAM, (yyvsp[(1) - (2)].asExpr) ); ;} + { HB_COMP_EXPR_FREE( (yyvsp[(2) - (2)].asExpr) ); (yyval.asExpr) = hb_compErrorAlias( HB_COMP_PARAM, (yyvsp[(1) - (2)].asExpr) ); ;} break; case 207: @@ -5222,7 +5222,7 @@ yyreduce: case 215: #line 738 "harbour.y" - { HB_COMP_EXPR_DELETE( (yyvsp[(1) - (2)].asExpr) ); (yyval.asExpr) = hb_compErrorAlias( HB_COMP_PARAM, (yyvsp[(2) - (2)].asExpr) ); ;} + { HB_COMP_EXPR_FREE( (yyvsp[(1) - (2)].asExpr) ); (yyval.asExpr) = hb_compErrorAlias( HB_COMP_PARAM, (yyvsp[(2) - (2)].asExpr) ); ;} break; case 216: @@ -5828,7 +5828,7 @@ yyreduce: case 410: #line 1126 "harbour.y" - { HB_COMP_EXPR_DELETE( hb_compExprGenPush( (yyvsp[(4) - (4)].asExpr), HB_COMP_PARAM ) ); + { HB_COMP_EXPR_FREE( hb_compExprGenPush( (yyvsp[(4) - (4)].asExpr), HB_COMP_PARAM ) ); hb_compRTVariableAdd( HB_COMP_PARAM, hb_compExprNewRTVar( NULL, (yyvsp[(1) - (4)].asExpr), HB_COMP_PARAM ), HB_TRUE ); ;} break; @@ -5836,7 +5836,7 @@ yyreduce: case 411: #line 1130 "harbour.y" { - HB_COMP_EXPR_DELETE( hb_compArrayDimPush( (yyvsp[(2) - (3)].asExpr), HB_COMP_PARAM ) ); + HB_COMP_EXPR_FREE( hb_compArrayDimPush( (yyvsp[(2) - (3)].asExpr), HB_COMP_PARAM ) ); hb_compRTVariableAdd( HB_COMP_PARAM, hb_compExprNewRTVar( NULL, (yyvsp[(1) - (3)].asExpr), HB_COMP_PARAM ), HB_TRUE ); ;} break; @@ -5857,7 +5857,7 @@ yyreduce: else if( HB_COMP_PARAM->iVarScope == VS_LOCAL && ( HB_COMP_PARAM->functions.pLast->funFlags & FUN_EXTBLOCK ) ) { - HB_COMP_EXPR_DELETE( hb_compExprGenPush( hb_compExprNewNil( HB_COMP_PARAM ), HB_COMP_PARAM ) ); + HB_COMP_EXPR_FREE( hb_compExprGenPush( hb_compExprNewNil( HB_COMP_PARAM ), HB_COMP_PARAM ) ); } ;} break; @@ -5876,22 +5876,22 @@ yyreduce: if( HB_COMP_PARAM->iVarScope & VS_STATIC ) { hb_compStaticDefStart( HB_COMP_PARAM ); /* switch to statics pcode buffer */ - HB_COMP_EXPR_DELETE( hb_compExprGenStatement( hb_compExprAssignStatic( hb_compExprNewVar( (yyvsp[(1) - (5)].string), HB_COMP_PARAM ), (yyvsp[(5) - (5)].asExpr), HB_COMP_PARAM ), HB_COMP_PARAM ) ); + HB_COMP_EXPR_FREE( hb_compExprGenStatement( hb_compExprAssignStatic( hb_compExprNewVar( (yyvsp[(1) - (5)].string), HB_COMP_PARAM ), (yyvsp[(5) - (5)].asExpr), HB_COMP_PARAM ), HB_COMP_PARAM ) ); hb_compStaticDefEnd( HB_COMP_PARAM, (yyvsp[(1) - (5)].string) ); } else if( HB_COMP_PARAM->iVarScope == VS_PUBLIC || HB_COMP_PARAM->iVarScope == VS_PRIVATE ) { - HB_COMP_EXPR_DELETE( hb_compExprGenPush( (yyvsp[(5) - (5)].asExpr), HB_COMP_PARAM ) ); + HB_COMP_EXPR_FREE( hb_compExprGenPush( (yyvsp[(5) - (5)].asExpr), HB_COMP_PARAM ) ); hb_compRTVariableAdd( HB_COMP_PARAM, hb_compExprNewRTVar( (yyvsp[(1) - (5)].string), NULL, HB_COMP_PARAM ), HB_TRUE ); } else if( HB_COMP_PARAM->iVarScope == VS_LOCAL && ( HB_COMP_PARAM->functions.pLast->funFlags & FUN_EXTBLOCK ) ) { - HB_COMP_EXPR_DELETE( hb_compExprGenPush( (yyvsp[(5) - (5)].asExpr), HB_COMP_PARAM ) ); + HB_COMP_EXPR_FREE( hb_compExprGenPush( (yyvsp[(5) - (5)].asExpr), HB_COMP_PARAM ) ); } else { - HB_COMP_EXPR_DELETE( hb_compExprGenStatement( hb_compExprAssign( hb_compExprNewVar( (yyvsp[(1) - (5)].string), HB_COMP_PARAM ), (yyvsp[(5) - (5)].asExpr), HB_COMP_PARAM ), HB_COMP_PARAM ) ); + HB_COMP_EXPR_FREE( hb_compExprGenStatement( hb_compExprAssign( hb_compExprNewVar( (yyvsp[(1) - (5)].string), HB_COMP_PARAM ), (yyvsp[(5) - (5)].asExpr), HB_COMP_PARAM ), HB_COMP_PARAM ) ); } HB_COMP_PARAM->iVarScope = (yyvsp[(3) - (5)].iNumber); ;} @@ -6114,7 +6114,7 @@ yyreduce: case 462: #line 1348 "harbour.y" - { HB_COMP_EXPR_DELETE( (yyvsp[(1) - (1)].asExpr) ); ;} + { HB_COMP_EXPR_FREE( (yyvsp[(1) - (1)].asExpr) ); ;} break; case 463: @@ -6204,7 +6204,7 @@ yyreduce: case 488: #line 1386 "harbour.y" - { HB_COMP_EXPR_DELETE( hb_compExprGenPush( (yyvsp[(2) - (4)].asExpr), HB_COMP_PARAM ) ); (yyval.iNumber) = hb_compGenJumpFalse( 0, HB_COMP_PARAM ); ;} + { HB_COMP_EXPR_FREE( hb_compExprGenPush( (yyvsp[(2) - (4)].asExpr), HB_COMP_PARAM ) ); (yyval.iNumber) = hb_compGenJumpFalse( 0, HB_COMP_PARAM ); ;} break; case 489: @@ -6224,7 +6224,7 @@ yyreduce: case 493: #line 1397 "harbour.y" - { HB_COMP_EXPR_DELETE( hb_compExprGenPush( (yyvsp[(3) - (4)].asExpr), HB_COMP_PARAM ) ); + { HB_COMP_EXPR_FREE( hb_compExprGenPush( (yyvsp[(3) - (4)].asExpr), HB_COMP_PARAM ) ); (yyval.iNumber) = hb_compGenJumpFalse( 0, HB_COMP_PARAM ); ;} break; @@ -6243,7 +6243,7 @@ yyreduce: case 496: #line 1407 "harbour.y" - { HB_COMP_EXPR_DELETE( hb_compExprGenPush( (yyvsp[(4) - (5)].asExpr), HB_COMP_PARAM ) ); + { HB_COMP_EXPR_FREE( hb_compExprGenPush( (yyvsp[(4) - (5)].asExpr), HB_COMP_PARAM ) ); (yyval.iNumber) = hb_compGenJumpFalse( 0, HB_COMP_PARAM ); ;} break; @@ -6305,7 +6305,7 @@ yyreduce: case 513: #line 1469 "harbour.y" { - HB_COMP_EXPR_DELETE( hb_compExprGenPush( (yyvsp[(3) - (4)].asExpr), HB_COMP_PARAM ) ); + HB_COMP_EXPR_FREE( hb_compExprGenPush( (yyvsp[(3) - (4)].asExpr), HB_COMP_PARAM ) ); (yyval.iNumber) = hb_compGenJumpFalse( 0, HB_COMP_PARAM ); ;} break; @@ -6327,7 +6327,7 @@ yyreduce: case 516: #line 1481 "harbour.y" { - HB_COMP_EXPR_DELETE( hb_compExprGenPush( (yyvsp[(4) - (5)].asExpr), HB_COMP_PARAM ) ); + HB_COMP_EXPR_FREE( hb_compExprGenPush( (yyvsp[(4) - (5)].asExpr), HB_COMP_PARAM ) ); (yyval.iNumber) = hb_compGenJumpFalse( 0, HB_COMP_PARAM ); ;} break; @@ -6359,7 +6359,7 @@ yyreduce: case 523: #line 1500 "harbour.y" { - HB_COMP_EXPR_DELETE( hb_compExprGenPush( (yyvsp[(2) - (3)].asExpr), HB_COMP_PARAM ) ); + HB_COMP_EXPR_FREE( hb_compExprGenPush( (yyvsp[(2) - (3)].asExpr), HB_COMP_PARAM ) ); (yyval.lNumber) = hb_compGenJumpFalse( 0, HB_COMP_PARAM ); ;} break; @@ -6453,16 +6453,16 @@ yyreduce: HB_COMP_EXPR_CLEAR( hb_compExprGenPush( hb_compExprNewPreInc( (yyvsp[(2) - (12)].asExpr), HB_COMP_PARAM ), HB_COMP_PARAM ) ); } hb_compGenJumpHere( ( HB_ULONG ) (yyvsp[(9) - (12)].lNumber), HB_COMP_PARAM ); - HB_COMP_EXPR_DELETE( hb_compExprGenPush( (yyvsp[(7) - (12)].asExpr), HB_COMP_PARAM ) ); /* end */ + HB_COMP_EXPR_FREE( hb_compExprGenPush( (yyvsp[(7) - (12)].asExpr), HB_COMP_PARAM ) ); /* end */ if( iSign ) { hb_compGenPCode1( ( HB_BYTE ) ( iSign > 0 ? HB_P_GREATER : HB_P_LESS ), HB_COMP_PARAM ); if( (yyvsp[(8) - (12)].asExpr) ) - HB_COMP_EXPR_DELETE( (yyvsp[(8) - (12)].asExpr) ); + HB_COMP_EXPR_FREE( (yyvsp[(8) - (12)].asExpr) ); } else { - HB_COMP_EXPR_DELETE( hb_compExprGenPush( (yyvsp[(8) - (12)].asExpr), HB_COMP_PARAM ) ); /* step */ + HB_COMP_EXPR_FREE( hb_compExprGenPush( (yyvsp[(8) - (12)].asExpr), HB_COMP_PARAM ) ); /* step */ hb_compGenPCode1( HB_P_FORTEST, HB_COMP_PARAM ); } @@ -6470,7 +6470,7 @@ yyreduce: hb_compLoopEnd( HB_COMP_PARAM ); if( hb_compExprAsSymbol( (yyvsp[(2) - (12)].asExpr) ) ) hb_compForEnd( HB_COMP_PARAM, hb_compExprAsSymbol( (yyvsp[(2) - (12)].asExpr) ) ); - HB_COMP_EXPR_DELETE( (yyvsp[(5) - (12)].asExpr) ); /* deletes $5, $2, $4 */ + HB_COMP_EXPR_FREE( (yyvsp[(5) - (12)].asExpr) ); /* deletes $5, $2, $4 */ HB_COMP_PARAM->functions.pLast->funFlags &= ~ ( FUN_WITH_RETURN | FUN_BREAK_CODE ); ;} break; @@ -6572,8 +6572,8 @@ yyreduce: hb_compLoopEnd( HB_COMP_PARAM ); HB_COMP_PARAM->functions.pLast->funFlags &= ~ ( FUN_WITH_RETURN | FUN_BREAK_CODE ); hb_compEnumEnd( HB_COMP_PARAM, (yyvsp[(2) - (10)].asExpr) ); - HB_COMP_EXPR_DELETE( (yyvsp[(2) - (10)].asExpr) ); - HB_COMP_EXPR_DELETE( (yyvsp[(4) - (10)].asExpr) ); + HB_COMP_EXPR_FREE( (yyvsp[(2) - (10)].asExpr) ); + HB_COMP_EXPR_FREE( (yyvsp[(4) - (10)].asExpr) ); ;} break; @@ -6607,7 +6607,7 @@ yyreduce: case 559: #line 1699 "harbour.y" { - HB_COMP_EXPR_DELETE( (yyvsp[(1) - (2)].asExpr) ); + HB_COMP_EXPR_FREE( (yyvsp[(1) - (2)].asExpr) ); hb_compGenPCode1( HB_P_POP, HB_COMP_PARAM ); ;} break; @@ -6742,7 +6742,7 @@ yyreduce: case 584: #line 1820 "harbour.y" { - HB_COMP_EXPR_DELETE( hb_compExprGenPush( (yyvsp[(2) - (2)].asExpr), HB_COMP_PARAM ) ); + HB_COMP_EXPR_FREE( hb_compExprGenPush( (yyvsp[(2) - (2)].asExpr), HB_COMP_PARAM ) ); hb_compGenPCode1( HB_P_SEQBLOCK, HB_COMP_PARAM ); (yyval.lNumber) = HB_COMP_PARAM->functions.pLast->lPCodePos; ;} @@ -6853,7 +6853,7 @@ yyreduce: #line 1905 "harbour.y" { hb_compLinePushIfInside( HB_COMP_PARAM ); - HB_COMP_EXPR_DELETE( hb_compExprGenPush( (yyvsp[(2) - (3)].asExpr), HB_COMP_PARAM ) ); + HB_COMP_EXPR_FREE( hb_compExprGenPush( (yyvsp[(2) - (3)].asExpr), HB_COMP_PARAM ) ); (yyval.lNumber) = HB_COMP_PARAM->functions.pLast->lPCodePos; hb_compGenPCode1( HB_P_WITHOBJECTSTART, HB_COMP_PARAM ); HB_COMP_PARAM->functions.pLast->wWithObjectCnt++; @@ -7500,9 +7500,9 @@ static void hb_compRTVariableGen( HB_COMP_DECL, const char * szCreateFun ) while( pVar ) { if( pVar->bPopValue ) - HB_COMP_EXPR_DELETE( hb_compExprGenPop( pVar->pVar, HB_COMP_PARAM ) ); + HB_COMP_EXPR_FREE( hb_compExprGenPop( pVar->pVar, HB_COMP_PARAM ) ); else - HB_COMP_EXPR_DELETE( pVar->pVar ); + HB_COMP_EXPR_FREE( pVar->pVar ); pDel = pVar; pVar = pVar->pPrev; hb_xfree( pDel ); @@ -7518,7 +7518,7 @@ void hb_compRTVariableKill( HB_COMP_DECL, PFUNCTION pFunc ) { pVar = pFunc->rtvars; - HB_COMP_EXPR_DELETE( pVar->pVar ); + HB_COMP_EXPR_FREE( pVar->pVar ); pFunc->rtvars = pVar->pPrev; hb_xfree( pVar ); } @@ -7547,7 +7547,7 @@ static void hb_compVariableDim( const char * szName, HB_EXPR_PTR pInitValue, HB_ if( HB_COMP_PARAM->iVarScope == VS_PUBLIC || HB_COMP_PARAM->iVarScope == VS_PRIVATE ) { hb_compVariableAdd( HB_COMP_PARAM, szName, hb_compVarTypeNew( HB_COMP_PARAM, 'A', NULL ) ); - HB_COMP_EXPR_DELETE( hb_compArrayDimPush( pInitValue, HB_COMP_PARAM ) ); + HB_COMP_EXPR_FREE( hb_compArrayDimPush( pInitValue, HB_COMP_PARAM ) ); hb_compRTVariableAdd( HB_COMP_PARAM, hb_compExprNewRTVar( szName, NULL, HB_COMP_PARAM ), HB_TRUE ); } else if( HB_COMP_PARAM->iVarScope & VS_STATIC ) @@ -7566,17 +7566,17 @@ static void hb_compVariableDim( const char * szName, HB_EXPR_PTR pInitValue, HB_ /* check if valid initializers were used but don't generate any code */ pAssign = hb_compExprAssignStatic( pVar, pInitValue, HB_COMP_PARAM ); /* delete all used expressions */ - HB_COMP_EXPR_DELETE( pAssign ); + HB_COMP_EXPR_FREE( pAssign ); hb_compStaticDefEnd( HB_COMP_PARAM, szName ); } else { hb_compVariableAdd( HB_COMP_PARAM, szName, hb_compVarTypeNew( HB_COMP_PARAM, 'A', NULL ) ); - HB_COMP_EXPR_DELETE( hb_compArrayDimPush( pInitValue, HB_COMP_PARAM ) ); + HB_COMP_EXPR_FREE( hb_compArrayDimPush( pInitValue, HB_COMP_PARAM ) ); if( HB_COMP_PARAM->iVarScope != VS_LOCAL || !( HB_COMP_PARAM->functions.pLast->funFlags & FUN_EXTBLOCK ) ) { - HB_COMP_EXPR_DELETE( hb_compExprGenPop( hb_compExprNewVar( szName, HB_COMP_PARAM ), HB_COMP_PARAM ) ); + HB_COMP_EXPR_FREE( hb_compExprGenPop( hb_compExprNewVar( szName, HB_COMP_PARAM ), HB_COMP_PARAM ) ); } } } @@ -7869,12 +7869,12 @@ static void hb_compSwitchEnd( HB_COMP_DECL ) hb_compGenJumpHere( ulExitPos, HB_COMP_PARAM ); if( pExpr ) - HB_COMP_EXPR_DELETE( pExpr ); + HB_COMP_EXPR_FREE( pExpr ); pCase = pSwitch->pCases; while( pCase ) { - HB_COMP_EXPR_DELETE( pCase->pExpr ); + HB_COMP_EXPR_FREE( pCase->pExpr ); pTmp = pCase->pNext; hb_xfree( (void *)pCase ); pCase = pTmp; @@ -7895,14 +7895,14 @@ void hb_compSwitchKill( HB_COMP_DECL, PFUNCTION pFunc ) while( pFunc->pSwitch->pCases ) { pCase = pFunc->pSwitch->pCases; - HB_COMP_EXPR_DELETE( pCase->pExpr ); + HB_COMP_EXPR_FREE( pCase->pExpr ); pFunc->pSwitch->pCases = pCase->pNext; hb_xfree( (void *) pCase ); } pSwitch = pFunc->pSwitch; pFunc->pSwitch = pSwitch->pPrev; if( pSwitch->pExpr ) - HB_COMP_EXPR_DELETE( pSwitch->pExpr ); + HB_COMP_EXPR_FREE( pSwitch->pExpr ); hb_xfree( (void *) pSwitch ); } } @@ -7922,7 +7922,7 @@ static HB_EXPR_PTR hb_compCheckPassByRef( HB_COMP_DECL, HB_EXPR_PTR pExpr ) else { pExpr = hb_compExprNewFunRef( hb_compExprAsSymbol( pExpr ), HB_COMP_PARAM ); - HB_COMP_EXPR_DELETE( pDelExpr ); + HB_COMP_EXPR_FREE( pDelExpr ); } return pExpr; } diff --git a/harbour/src/compiler/hbcomp.c b/harbour/src/compiler/hbcomp.c index 384c8071ad..932d211618 100644 --- a/harbour/src/compiler/hbcomp.c +++ b/harbour/src/compiler/hbcomp.c @@ -100,7 +100,6 @@ static HB_EXPR_PTR hb_compExprNew( HB_COMP_DECL, HB_EXPRTYPE iType ) pExpr->ExprType = iType; pExpr->pNext = NULL; pExpr->ValType = HB_EV_UNKNOWN; - pExpr->Counter = 1; return pExpr; } @@ -109,20 +108,7 @@ static HB_EXPR_PTR hb_compExprNew( HB_COMP_DECL, HB_EXPRTYPE iType ) */ static void hb_compExprClear( HB_COMP_DECL, HB_EXPR_PTR pExpr ) { - if( --pExpr->Counter == 0 ) - hb_compExprDealloc( HB_COMP_PARAM, pExpr ); -} - -/* Delete all components and delete self - */ -static void hb_compExprDelete( HB_COMP_DECL, HB_EXPR_PTR pExpr ) -{ - HB_TRACE(HB_TR_DEBUG, ("hb_compExprDelete(%p,%p)", HB_COMP_PARAM, pExpr)); - if( pExpr && --pExpr->Counter == 0 ) - { - HB_EXPR_USE( pExpr, HB_EA_DELETE ); - hb_compExprDealloc( HB_COMP_PARAM, pExpr ); - } + hb_compExprDealloc( HB_COMP_PARAM, pExpr ); } /* Delete all components and delete self @@ -130,11 +116,9 @@ static void hb_compExprDelete( HB_COMP_DECL, HB_EXPR_PTR pExpr ) static void hb_compExprFree( HB_COMP_DECL, HB_EXPR_PTR pExpr ) { HB_TRACE(HB_TR_DEBUG, ("hb_compExprFree()")); - if( --pExpr->Counter == 0 ) - { - HB_EXPR_USE( pExpr, HB_EA_DELETE ); - hb_compExprDealloc( HB_COMP_PARAM, pExpr ); - } + + HB_EXPR_USE( pExpr, HB_EA_DELETE ); + hb_compExprDealloc( HB_COMP_PARAM, pExpr ); } void hb_compExprLstDealloc( HB_COMP_DECL ) @@ -146,7 +130,7 @@ void hb_compExprLstDealloc( HB_COMP_DECL ) HB_COMP_PARAM->pExprLst = NULL; do { - hb_compExprDelete( HB_COMP_PARAM, &pExp->Expression ); + hb_compExprFree( HB_COMP_PARAM, &pExp->Expression ); pExp = pExp->pNext; } while( pExp != pExpItm ); @@ -184,7 +168,6 @@ static const HB_COMP_FUNCS s_comp_funcs = hb_compExprNew, hb_compExprClear, hb_compExprFree, - hb_compExprDelete, hb_compErrorType, hb_compErrorSyntax, diff --git a/harbour/src/macro/macro.y b/harbour/src/macro/macro.y index cd21d4bb6f..16cf7b067f 100644 --- a/harbour/src/macro/macro.y +++ b/harbour/src/macro/macro.y @@ -779,7 +779,6 @@ static HB_EXPR_PTR hb_macroExprNew( HB_COMP_DECL, HB_EXPRTYPE iType ) pExpr->ExprType = iType; pExpr->pNext = NULL; pExpr->ValType = HB_EV_UNKNOWN; - pExpr->Counter = 1; return pExpr; } @@ -789,20 +788,8 @@ static HB_EXPR_PTR hb_macroExprNew( HB_COMP_DECL, HB_EXPRTYPE iType ) static void hb_macroExprClear( HB_COMP_DECL, HB_EXPR_PTR pExpr ) { HB_SYMBOL_UNUSED( HB_COMP_PARAM ); - if( --pExpr->Counter == 0 ) - pExpr->ExprType = HB_ET_NONE; -} -/* Delete all components and delete self - */ -static void hb_macroExprDelete( HB_COMP_DECL, HB_EXPR_PTR pExpr ) -{ - HB_TRACE(HB_TR_DEBUG, ("hb_macroExprDelete(%p,%p)", HB_COMP_PARAM, pExpr)); - if( pExpr && --pExpr->Counter == 0 ) - { - HB_EXPR_USE( pExpr, HB_EA_DELETE ); - pExpr->ExprType = HB_ET_NONE; - } + pExpr->ExprType = HB_ET_NONE; } /* Delete all components and delete self @@ -810,11 +797,9 @@ static void hb_macroExprDelete( HB_COMP_DECL, HB_EXPR_PTR pExpr ) static void hb_macroExprFree( HB_COMP_DECL, HB_EXPR_PTR pExpr ) { HB_TRACE(HB_TR_DEBUG, ("hb_macroExprFree()")); - if( --pExpr->Counter == 0 ) - { - HB_EXPR_USE( pExpr, HB_EA_DELETE ); - pExpr->ExprType = HB_ET_NONE; - } + + HB_EXPR_USE( pExpr, HB_EA_DELETE ); + pExpr->ExprType = HB_ET_NONE; } /* Deallocate all memory used by expression optimizer */ @@ -872,7 +857,6 @@ static const HB_COMP_FUNCS s_macro_funcs = hb_macroExprNew, hb_macroExprClear, hb_macroExprFree, - hb_macroExprDelete, hb_macroErrorType, hb_macroErrorSyntax, diff --git a/harbour/src/macro/macro.yyc b/harbour/src/macro/macro.yyc index e4ef3f8979..5e1d18cb59 100644 --- a/harbour/src/macro/macro.yyc +++ b/harbour/src/macro/macro.yyc @@ -3118,7 +3118,6 @@ static HB_EXPR_PTR hb_macroExprNew( HB_COMP_DECL, HB_EXPRTYPE iType ) pExpr->ExprType = iType; pExpr->pNext = NULL; pExpr->ValType = HB_EV_UNKNOWN; - pExpr->Counter = 1; return pExpr; } @@ -3128,20 +3127,8 @@ static HB_EXPR_PTR hb_macroExprNew( HB_COMP_DECL, HB_EXPRTYPE iType ) static void hb_macroExprClear( HB_COMP_DECL, HB_EXPR_PTR pExpr ) { HB_SYMBOL_UNUSED( HB_COMP_PARAM ); - if( --pExpr->Counter == 0 ) - pExpr->ExprType = HB_ET_NONE; -} -/* Delete all components and delete self - */ -static void hb_macroExprDelete( HB_COMP_DECL, HB_EXPR_PTR pExpr ) -{ - HB_TRACE(HB_TR_DEBUG, ("hb_macroExprDelete(%p,%p)", HB_COMP_PARAM, pExpr)); - if( pExpr && --pExpr->Counter == 0 ) - { - HB_EXPR_USE( pExpr, HB_EA_DELETE ); - pExpr->ExprType = HB_ET_NONE; - } + pExpr->ExprType = HB_ET_NONE; } /* Delete all components and delete self @@ -3149,11 +3136,9 @@ static void hb_macroExprDelete( HB_COMP_DECL, HB_EXPR_PTR pExpr ) static void hb_macroExprFree( HB_COMP_DECL, HB_EXPR_PTR pExpr ) { HB_TRACE(HB_TR_DEBUG, ("hb_macroExprFree()")); - if( --pExpr->Counter == 0 ) - { - HB_EXPR_USE( pExpr, HB_EA_DELETE ); - pExpr->ExprType = HB_ET_NONE; - } + + HB_EXPR_USE( pExpr, HB_EA_DELETE ); + pExpr->ExprType = HB_ET_NONE; } /* Deallocate all memory used by expression optimizer */ @@ -3211,7 +3196,6 @@ static const HB_COMP_FUNCS s_macro_funcs = hb_macroExprNew, hb_macroExprClear, hb_macroExprFree, - hb_macroExprDelete, hb_macroErrorType, hb_macroErrorSyntax, @@ -3417,3 +3401,4 @@ int hb_macrolex( YYSTYPE *yylval_ptr, HB_MACRO_PTR pMacro ) } #endif /* HB_MACRO_PPLEX */ + diff --git a/harbour/src/macro/macro.yyh b/harbour/src/macro/macro.yyh index 45798f24c5..97a51042cd 100644 --- a/harbour/src/macro/macro.yyh +++ b/harbour/src/macro/macro.yyh @@ -164,3 +164,6 @@ typedef union YYSTYPE # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 #endif + + +