2006-09-29 22:50 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/source/vm/classes.c
    * allow to access object variables using assign messages without
      parameter. I do not want to add symmetric behavior for access messages
      though it's technically possible but such things should be controlled
      by programmer because access messages can have less restricted scoping
      then assign ones (READONLY) so I'll add new rule for it in hbclass.ch

  * harbour/source/vm/hvm.c
    * fixed warning message when object variable reference is
      generated using macro compiler without '_' as prefix.
This commit is contained in:
Przemyslaw Czerpak
2006-09-29 20:51:46 +00:00
parent 73900f8855
commit bb8804e7ac
3 changed files with 66 additions and 51 deletions

View File

@@ -8,6 +8,18 @@
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
[ ; #translate Super( <SuperClassN> ): => ::<SuperClassN>: ] ;
[ ; #translate Super( <SuperClass1> ): => ::<SuperClass1>: ] ;
[ ; #translate Super(): => ::<SuperClass1>: ] ;
[ ; #translate Super: => ::<SuperClass1>: ] ;
[ ; #translate ::Super : => ::<SuperClass1>: ]
These rules introduce very serious bug - they are breaking supercasting
in code which makes sth like:
::super:super:super:msg
or in any other code which sends SUPER message to some other class
objects. I will have to remove them. At least the last three ones.
There were some other things I wanted to write about but it's too late
and I'm to tired - sorry. If you will have any question please ask. if
you will notice some problems with current rules please inform me.
2006-09-29 22:50 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

View File

@@ -3458,26 +3458,27 @@ static HARBOUR hb___msgSetClsData( void )
hb_stackBaseItem()->item.asSymbol.stackstate->uiClass ];
PMETHOD pMethod = pClass->pMethods +
hb_stackBaseItem()->item.asSymbol.stackstate->uiMethod;
PHB_ITEM pReturn = hb_stackItemFromBase( 1 );
PHB_ITEM pReturn = hb_param( 1, HB_IT_ANY );
if( !pReturn )
return;
else if( HB_IS_BYREF( pReturn ) )
pReturn = hb_itemUnRef( pReturn );
hb_arrayGet( pClass->pClassDatas, pMethod->uiData, hb_stackReturnItem() );
if( pMethod->itemType && ! ( pMethod->itemType & pReturn->type ) )
else
{
if( pMethod->itemType == HB_IT_NUMINT && HB_IS_NUMERIC( pReturn ) )
hb_itemPutNInt( pReturn, hb_itemGetNInt( pReturn ) );
else
if( pMethod->itemType && ! ( pMethod->itemType & pReturn->type ) )
{
(s___msgTypeErr.value.pFunPtr)();
return;
if( pMethod->itemType == HB_IT_NUMINT && HB_IS_NUMERIC( pReturn ) )
hb_itemPutNInt( pReturn, hb_itemGetNInt( pReturn ) );
else
{
(s___msgTypeErr.value.pFunPtr)();
return;
}
}
}
hb_arraySet( pClass->pClassDatas, pMethod->uiData, pReturn );
hb_itemReturnForward( pReturn );
hb_arraySet( pClass->pClassDatas, pMethod->uiData, pReturn );
hb_itemReturnForward( pReturn );
}
}
/*
@@ -3507,27 +3508,28 @@ static HARBOUR hb___msgSetShrData( void )
hb_stackBaseItem()->item.asSymbol.stackstate->uiClass ];
PMETHOD pMethod = pClass->pMethods +
hb_stackBaseItem()->item.asSymbol.stackstate->uiMethod;
PHB_ITEM pReturn = hb_stackItemFromBase( 1 );
PHB_ITEM pReturn = hb_param( 1, HB_IT_ANY );
if( !pReturn )
return;
else if( HB_IS_BYREF( pReturn ) )
pReturn = hb_itemUnRef( pReturn );
if( pMethod->itemType && ! ( pMethod->itemType & pReturn->type ) )
hb_arrayGet( s_pClasses[ pMethod->uiSprClass ].pSharedDatas,
pMethod->uiData, hb_stackReturnItem() );
else
{
if( pMethod->itemType == HB_IT_NUMINT && HB_IS_NUMERIC( pReturn ) )
hb_itemPutNInt( pReturn, hb_itemGetNInt( pReturn ) );
else
if( pMethod->itemType && ! ( pMethod->itemType & pReturn->type ) )
{
(s___msgTypeErr.value.pFunPtr)();
return;
if( pMethod->itemType == HB_IT_NUMINT && HB_IS_NUMERIC( pReturn ) )
hb_itemPutNInt( pReturn, hb_itemGetNInt( pReturn ) );
else
{
(s___msgTypeErr.value.pFunPtr)();
return;
}
}
}
hb_arraySet( s_pClasses[ pMethod->uiSprClass ].pSharedDatas,
pMethod->uiData, pReturn );
hb_itemReturnForward( pReturn );
hb_arraySet( s_pClasses[ pMethod->uiSprClass ].pSharedDatas,
pMethod->uiData, pReturn );
hb_itemReturnForward( pReturn );
}
}
/*
@@ -3565,7 +3567,7 @@ static HARBOUR hb___msgGetData( void )
*/
static HARBOUR hb___msgSetData( void )
{
PHB_ITEM pReturn = hb_stackItemFromBase( 1 );
PHB_ITEM pReturn = hb_param( 1, HB_IT_ANY );
PHB_ITEM pObject = hb_stackSelfItem();
USHORT uiObjClass = pObject->item.asArray.value->uiClass;
USHORT uiClass = hb_stackBaseItem()->item.asSymbol.stackstate->uiClass;
@@ -3574,22 +3576,6 @@ static HARBOUR hb___msgSetData( void )
hb_stackBaseItem()->item.asSymbol.stackstate->uiMethod;
ULONG ulIndex = pMethod->uiData;
if( !pReturn )
return;
else if( HB_IS_BYREF( pReturn ) )
pReturn = hb_itemUnRef( pReturn );
if( pMethod->itemType && ! ( pMethod->itemType & pReturn->type ) )
{
if( pMethod->itemType == HB_IT_NUMINT && HB_IS_NUMERIC( pReturn ) )
hb_itemPutNInt( pReturn, hb_itemGetNInt( pReturn ) );
else
{
(s___msgTypeErr.value.pFunPtr)();
return;
}
}
if( uiClass != uiObjClass )
{
ulIndex += hb_clsParentInstanceOffset( &s_pClasses[ uiObjClass ],
@@ -3600,11 +3586,28 @@ static HARBOUR hb___msgSetData( void )
ulIndex += pMethod->uiOffset;
}
/* will arise only if the class has been modified after first instance */
if( ulIndex > hb_arrayLen( pObject ) ) /* Resize needed ? */
hb_arraySize( pObject, ulIndex ); /* Make large enough */
hb_arraySet( pObject, ulIndex, pReturn );
hb_itemReturnForward( pReturn );
if( !pReturn )
hb_arrayGet( pObject, ulIndex, hb_stackReturnItem() );
else
{
if( pMethod->itemType && ! ( pMethod->itemType & pReturn->type ) )
{
if( pMethod->itemType == HB_IT_NUMINT && HB_IS_NUMERIC( pReturn ) )
hb_itemPutNInt( pReturn, hb_itemGetNInt( pReturn ) );
else
{
(s___msgTypeErr.value.pFunPtr)();
return;
}
}
/* will arise only if the class has been modified after first instance */
if( ulIndex > hb_arrayLen( pObject ) ) /* Resize needed ? */
hb_arraySize( pObject, ulIndex ); /* Make large enough */
hb_arraySet( pObject, ulIndex, pReturn );
hb_itemReturnForward( pReturn );
}
}
/* No comment :-) */

View File

@@ -4263,7 +4263,7 @@ static void hb_vmPushObjectVarRef( void )
if( !hb_objGetVarRef( hb_stackSelfItem(), pSym, &sStackState ) &&
hb_vmRequestQuery() == 0 )
hb_errRT_BASE_SubstR( EG_NOVARMETHOD, 1005, NULL, pSym->szName + 1, 1, hb_stackSelfItem() );
hb_errRT_BASE_SubstR( EG_NOVARMETHOD, 1005, NULL, pSym->szName + ( pSym->szName[ 0 ] == '_' ? 1 : 0 ), 1, hb_stackSelfItem() );
hb_stackOldFrame( &sStackState );