parameter self add to INLINE methods.
test program inline.prg
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 )
|
||||
|
||||
47
harbour/tests/working/inline.prg
Normal file
47
harbour/tests/working/inline.prg
Normal 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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user