From 4c1f0a1e447a65b92efea734bbb4bf12692de0d8 Mon Sep 17 00:00:00 2001 From: Eddie Runia Date: Fri, 8 Oct 1999 18:21:51 +0000 Subject: [PATCH] see changelog --- harbour/ChangeLog | 10 ++++++++++ harbour/include/extend.h | 1 + harbour/source/rtl/classes.c | 1 + harbour/source/vm/hvm.c | 12 ++++++++++++ harbour/tests/inhprob.prg | 33 +++++++++++++++++++++++++++++++++ 5 files changed, 57 insertions(+) create mode 100644 harbour/tests/inhprob.prg diff --git a/harbour/ChangeLog b/harbour/ChangeLog index b6efc9f1c8..2bdc8096c0 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,13 @@ +19991008-20:00 CET Eddie Runia + * include/extend.h + uiPrevCls added to BASEARRAY + * source/rtl/classes.c + PrevCls set with previous class when using Super + * source/vm/hvm.c + Previous class handle restore _after_ retrieving the method + + tests/inhprob.c + Test program + 19991008-15:42 GMT+2 Ryszard Glab *source/rdd/dbcmd.c diff --git a/harbour/include/extend.h b/harbour/include/extend.h index 87bc553eb4..f161660014 100644 --- a/harbour/include/extend.h +++ b/harbour/include/extend.h @@ -198,6 +198,7 @@ typedef struct _HB_BASEARRAY ULONG ulLen; /* number of items in the array */ USHORT uiHolders; /* number of holders of this array */ USHORT uiClass; /* offset to the classes base if it is an object */ + USHORT uiPrevCls; /* previous class handle */ BOOL bSuperCast; /* is it a super cast ? */ } BASEARRAY, * PBASEARRAY, * BASEARRAY_PTR; diff --git a/harbour/source/rtl/classes.c b/harbour/source/rtl/classes.c index 0e2572a1cc..fc44e3effd 100644 --- a/harbour/source/rtl/classes.c +++ b/harbour/source/rtl/classes.c @@ -1074,6 +1074,7 @@ static HARBOUR hb___msgSuper( void ) pSuper->item.asArray.value = pNewBase; + pNewBase->uiPrevCls = pNewBase->uiClass; pNewBase->uiClass = uiSuperCls; pNewBase->uiHolders = 1; /* New item is returned */ pNewBase->bSuperCast = TRUE; /* Do not dispose pItems !! */ diff --git a/harbour/source/vm/hvm.c b/harbour/source/vm/hvm.c index 755385a616..50752d528d 100644 --- a/harbour/source/vm/hvm.c +++ b/harbour/source/vm/hvm.c @@ -2153,6 +2153,7 @@ void hb_vmDo( USHORT uiParams ) LONG wStackBase = hb_stack.pBase - hb_stack.pItems; /* as the stack memory block could change */ LONG wItemIndex = pItem - hb_stack.pItems; PHB_ITEM pSelf = hb_stack.pPos - uiParams - 1; /* NIL, OBJECT or BLOCK */ + PBASEARRAY pSelfBase; PHB_FUNC pFunc; int iStatics = hb_stack.iStatics; /* Return iStatics position */ BOOL bDebugPrevState = s_bDebugging; @@ -2187,7 +2188,18 @@ void hb_vmDo( USHORT uiParams ) if( pSym == &( hb_symEval ) && IS_BLOCK( pSelf ) ) pFunc = pSym->pFunPtr; /* __EVAL method = function */ else + { pFunc = hb_objGetMethod( pSelf, pSym ); + if( IS_OBJECT( pSelf ) ) /* Object passed */ + { + pSelfBase = pSelf->item.asArray.value; + if( pSelfBase->bSuperCast ) + { + pSelfBase->bSuperCast = FALSE; + pSelfBase->uiClass = pSelfBase->uiPrevCls; + } + } + } if( pFunc ) pFunc(); diff --git a/harbour/tests/inhprob.prg b/harbour/tests/inhprob.prg new file mode 100644 index 0000000000..91c1685ebf --- /dev/null +++ b/harbour/tests/inhprob.prg @@ -0,0 +1,33 @@ +#include "hbclass.ch" + +function Main() + + local o := Three():New() + + o:CheckIt() + +return nil + +CLASS One + + METHOD New() INLINE Self + + METHOD Test() INLINE QOut( "One" ) + + METHOD CheckIt() INLINE ::Test() + +ENDCLASS + +CLASS Two FROM One + + METHOD Test() INLINE Super:Test() + + METHOD CheckIt() INLINE Super:CheckIt() + +ENDCLASS + +CLASS Three FROM Two + + METHOD Test() INLINE QOut( "Three" ) + +ENDCLASS