From d46faa5837c0177de4230ffe8d12badcae25995d Mon Sep 17 00:00:00 2001 From: Ryszard Glab Date: Sun, 23 Apr 2000 17:06:17 +0000 Subject: [PATCH] ChangeLog 200423-19:10 GMT+1 --- harbour/ChangeLog | 23 +++++++++++++++++++++++ harbour/source/compiler/harbour.y | 4 ++-- harbour/source/vm/itemapi.c | 3 +++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 567da1cc80..4ae136f074 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,26 @@ +20000423-19:10 GMT+1 Ryszard Glab + + *source/compiler/harbour.y + *added support for using references as an array element + { 1, @var } + + *source/vm/itemapi.c + *added support for handling of references in arrays + Example: + a := 1 + CallProc( { @a } ) + ? a //prints: 2 + + PROC CallProc( x ) + LOCAL y:=x[ 1 ] + y++ + + NOTE: references in arrays cannot be used with usual operators + For example (using the above code) + ? y + x[ 1 ] + will cause 'argument error: +' because hb_vmPlus() (and others) + doesn't dereference arguments. + 20000423-18:18 GMT+1 Ryszard Glab *source/compiler/harbour.y diff --git a/harbour/source/compiler/harbour.y b/harbour/source/compiler/harbour.y index 125285635a..f43a1830aa 100644 --- a/harbour/source/compiler/harbour.y +++ b/harbour/source/compiler/harbour.y @@ -925,8 +925,8 @@ IndexList : '[' Expression { $$ = hb_compExprNewArrayAt( $$ = hb_compExprNewCodeBlock(); } BlockNoVar diff --git a/harbour/source/vm/itemapi.c b/harbour/source/vm/itemapi.c index 293ba41466..779001f0d1 100644 --- a/harbour/source/vm/itemapi.c +++ b/harbour/source/vm/itemapi.c @@ -1033,6 +1033,9 @@ void hb_itemCopy( PHB_ITEM pDest, PHB_ITEM pSource ) { HB_TRACE(HB_TR_DEBUG, ("hb_itemCopy(%p, %p)", pDest, pSource)); + if( HB_IS_BYREF( pDest ) ) + pDest = hb_itemUnRef( pDest ); + if( pDest->type ) hb_itemClear( pDest );