[fpc-devel] Unexpected behaviour for With ... Do construct

ik idokan at gmail.com
Tue Feb 26 12:34:27 CET 2008


You made the following error:

With FOtherClass Do;

You added semiclone after "do", so you exist the scope of with
...Actually the compiler works really good in this case :)

Ido

On Tue, Feb 26, 2008 at 1:11 PM,  <paul at interfacedesign.co.uk> wrote:
> I've hit a subtle issue whilst using the With ... Do construct in a program I am
>  working on. I have isolated the behaviour to the following trivial unit:
>
>  Unit TestClasses;
>
>  Interface
>
>  Type
>   TOtherClass = Class
>   Public
>     SomeValue: Boolean;
>   End;
>   TMainClass = Class
>   Public
>     FOtherClass: TOtherClass;
>     Procedure DoSomething;
>   End;
>
>  Implementation
>
>  Procedure TMainClass.DoSomething;
>  Var
>   Test: Boolean;
>  Begin
>  // This compiles ok:
>   Test := FOtherClass.SomeValue;
>
>  // This Fails to compile:
>   With FOtherClass Do;
>     Test := SomeValue;
>  End;
>
>  End.
>
>  The compilation halts with:
>
>   TestClasses.pas(27,22) Error: Identifier not found "SomeValue"
>
>  I am working off Lazarus SVN with FPC 2.2.1 on Windows and 2.2.0 on Linux. The
>  problem occurs in both environments, the version stamps are:
>   v0.9.25 r14253 i386-win32-win32/win64
>   v0.9.25 r14253M i386-linux-gtk 2 (beta)
>
>  Is this a compiler bug or am I missing something?
>
>  Thanks,
>
>  Paul
>  _______________________________________________
>  fpc-devel maillist  -  fpc-devel at lists.freepascal.org
>  http://lists.freepascal.org/mailman/listinfo/fpc-devel
>



-- 
http://ik.homelinux.org/



More information about the fpc-devel mailing list