parameter self add to INLINE methods.

test program inline.prg
This commit is contained in:
Eddie Runia
1999-05-11 18:23:40 +00:00
parent 6b4cbb9208
commit 7b81aa2403
3 changed files with 55 additions and 1 deletions

View File

@@ -1,3 +1,9 @@
19990511-19:20 Eddie Runia
* source/rtl/classes.c
(Default) parameter self added to INLINE methods
* tests/working/inline.prg
Test of INLINE method.
19990511-09:55 Eddie Runia
* source/rtl/objfunc.prg, source/tools/stringp.prg
created from tests/working/debugtst.prg

View File

@@ -170,9 +170,10 @@ static HARBOUR EvalInline( void )
PushSymbol( &symEval );
Push( &block );
Push( stack.pBase + 1 ); /* Push self */
for( w = 1; w <= _pcount(); w++ )
Push( _param( w, IT_ANY ) );
Do( _pcount() );
Do( _pcount() + 1 ); /* Self is also an argument */
}
static HARBOUR Virtual( void )

View File

@@ -0,0 +1,47 @@
//
// Test of inline function
//
function Main()
local oForm := TForm():New()
QOut( oForm:ClassName() )
oForm:cText := "Let's show a form here :-)"
oForm:Show()
return nil
function TForm()
static oClass
if oClass == nil
oClass = TClass():New( "TFORM" ) // starts a new class definition
oClass:AddData( "cText" ) // define this class objects datas
oClass:AddData( "nTop" )
oClass:AddData( "nLeft" )
oClass:AddData( "nBottom" )
oClass:AddData( "nRight" )
oClass:AddMethod( "New", @New() ) // define this class objects methods
oClass:AddInline( "Show", {|self| QOut( self:cText ) } )
oClass:Create() // builds this class
endif
return oClass:Instance() // builds an object of this class
static function New()
local Self := QSelf()
::nTop = 10
::nLeft = 10
::nBottom = 20
::nRight = 40
return Self