* always create a temp for MacPas objects in with-expressions (mantis

#13210)

git-svn-id: trunk@12753 -
This commit is contained in:
Jonas Maebe 2009-02-19 22:43:59 +00:00
parent 09515e6b34
commit 3dd32daa03
3 changed files with 32 additions and 1 deletions

1
.gitattributes vendored
View File

@ -8761,6 +8761,7 @@ tests/webtbs/tw1310.pp svneol=native#text/plain
tests/webtbs/tw13133.pp svneol=native#text/plain
tests/webtbs/tw1318.pp svneol=native#text/plain
tests/webtbs/tw13187.pp svneol=native#text/plain
tests/webtbs/tw13210.pp svneol=native#text/plain
tests/webtbs/tw1323.pp svneol=native#text/plain
tests/webtbs/tw1327.pp svneol=native#text/plain
tests/webtbs/tw1331.pp svneol=native#text/plain

View File

@ -506,7 +506,14 @@ implementation
(tloadnode(hp).symtable=current_procinfo.procdef.localst) or
(tloadnode(hp).symtable=current_procinfo.procdef.parast) or
(tloadnode(hp).symtable.symtabletype in [staticsymtable,globalsymtable])
) then
) and
{ MacPas objects are mapped to classes, and the MacPas compilers
interpret with-statements with MacPas objects the same way
as records (the object referenced by the with-statement
must remain constant)
}
not(is_class(hp.resultdef) and
(m_mac in current_settings.modeswitches)) then
begin
{ simple load, we can reference direct }
refnode:=p;

23
tests/webtbs/tw13210.pp Normal file
View File

@ -0,0 +1,23 @@
{$ifdef FPC}
{$mode macpas}
{$endif}
{$ifdef __GPC__}
{$mac-objects}
{$endif}
program withtest2;
type obj = object i: integer end;
var p, q, r: obj;
begin
new( p);
new( q);
p.i:= 1;
q.i:= 2;
r:= p;
with r do
begin
r:=q;
writeln( i);
if (i<>1) then
halt(1);
end
end.