mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-14 03:19:27 +02:00
* always create a temp for MacPas objects in with-expressions (mantis
#13210) git-svn-id: trunk@12753 -
This commit is contained in:
parent
09515e6b34
commit
3dd32daa03
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -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
|
||||
|
@ -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
23
tests/webtbs/tw13210.pp
Normal 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.
|
Loading…
Reference in New Issue
Block a user