[fpc-devel] FPC-JVM: Problem with "with" in nested records

Nicola acquario73 at email.it
Tue Feb 12 11:58:31 CET 2013


Hello everyone! I'm working on a framework that remaps all controls 
native iOS and Android (TMLabel = TLabel in win, UILabel in iOS, 
TextView in Android, etc). Congratulations to the compiler Jvm, allows 
me to use a lot of Pascal code in Android, but I found a problem with 
nested command "with". I built ppcjvm with revision 23596. This is the 
sample code:

type
   TRec1 = record
       a: integer;
   end;

   TRec2 = record
     i: integer;
     Rec1: TRec1;
   end;

   TMyClass = class
   protected
     Data: TRec2;
   public
     procedure Test;
   end;

procedure TMyClass.Test;
var
     LocData: TRec2;
begin
     with LocData do
         Rec1.a := 123;
     Log('with: ' + IntToStr(LocData.Rec1.a));            // success, it 
shows 123

     LocData.Rec1.a := 124;
     Log('not with: ' + IntToStr(LocData.Rec1.a));        // success it 
shows 124

     with Data do
         Rec1.a := 123;
     Log('with: ' + IntToStr(Data.Rec1.a));            // !!FAIL!!, it 
shows 0

     Data.Rec1.a := 124;
     Log('not with: ' + IntToStr(Data.Rec1.a));        // success it 
shows 124
end;

 
 
 --
 Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e SMTP autenticato? GRATIS solo con Email.it http://www.email.it/f
 
 Sponsor:
 Su MisterCupido.com puoi creare REGALI PERSONALIZZATI. Stampa le tue Foto su: Cuscini, Tazze, Puzzle, Peluche, Magliette, Poster... Consegne in tutta Italia in soli 2-3 giorni
 Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=12385&d=12-2



More information about the fpc-devel mailing list