Using v1.101 I get a warning about the use of the THIS keyword.
Compiling "strcls.hla" to "strcls.asm"
Error in file "strcls.hla" at line 24
Misuse of THIS reserved word outside class.
Near: << this >>
Error in file "strcls.hla" at line 24
syntax error, unexpected '.'.
Near: << . >>
procedure create; @nodisplay;
begin create;
push( eax );
if( esi = 0 ) then
mem.alloc( @size( strcls ));
mov( eax, esi );
endif;
mov( &strcls._VMT_, this._pVMT_ );
mov( 0, this.s );
pop( eax );
ret();
end create;
The error points to the line with "this._pVMT_"
All the examples in the HLA reference show it this way.
I am not sure how I am outside of the class.
You must pre-pend the classname to any procedure or method declaration that you wish to be associated with a particular class.
procedure strcls.create; @nodisplay;
Nathan.
NB -- This pre-pending doesn't apply to either the 'begin' or 'end' clauses of the declaration.
procedure strcls.create; @nodisplay;
begin create;
push( eax );
if( esi = 0 ) then
mem.alloc( @size( strcls ));
mov( eax, esi );
endif;
mov( &strcls._VMT_, this._pVMT_ );
mov( 0, this.s );
pop( eax );
ret();
end create;
Nathan.
Nothing like completely missing the obvious.
I have no idea how I missed seeing that.
(is there a smiley for smacking yourself upside the head)
(http://www.websmileys.com/sm/crazy/1261.gif)
Many more here:
http://www.websmileys.com/