mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-06-25 17:59:25 +02:00
* fix regression introduced with r47625 for Mantis #38122: when checking for a dereferentiation of the Self parameter subscript and vec nodes need to be kept
+ added test git-svn-id: trunk@47747 -
This commit is contained in:
parent
2bd7877ec0
commit
1efeb5851a
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -18599,6 +18599,7 @@ tests/webtbs/tw38069.pp svneol=native#text/pascal
|
|||||||
tests/webtbs/tw38074.pp svneol=native#text/pascal
|
tests/webtbs/tw38074.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw38083.pp svneol=native#text/pascal
|
tests/webtbs/tw38083.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw38122.pp svneol=native#text/pascal
|
tests/webtbs/tw38122.pp svneol=native#text/pascal
|
||||||
|
tests/webtbs/tw38122b.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw3814.pp svneol=native#text/plain
|
tests/webtbs/tw3814.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw38145a.pp svneol=native#text/pascal
|
tests/webtbs/tw38145a.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw38145b.pp svneol=native#text/pascal
|
tests/webtbs/tw38145b.pp svneol=native#text/pascal
|
||||||
|
@ -4014,8 +4014,27 @@ implementation
|
|||||||
|
|
||||||
if methodpointer.nodetype<>typen then
|
if methodpointer.nodetype<>typen then
|
||||||
begin
|
begin
|
||||||
{ Remove all postfix operators }
|
{ if the value a type helper works on is a derefentiation (before
|
||||||
|
removing postix operators) we need to pass the original pointer
|
||||||
|
as Self as the Self value might be changed by the helper }
|
||||||
|
if is_objectpascal_helper(tdef(procdefinition.owner.defowner)) and
|
||||||
|
not is_implicit_pointer_object_type(tobjectdef(procdefinition.owner.defowner).extendeddef) then
|
||||||
|
begin
|
||||||
|
hpt:=methodpointer;
|
||||||
|
|
||||||
|
hpt:=actualtargetnode(@hpt)^;
|
||||||
|
if hpt.nodetype=derefn then
|
||||||
|
begin
|
||||||
|
tmp:=tderefnode(hpt).left;
|
||||||
|
tderefnode(hpt).left:=nil;
|
||||||
|
methodpointer.free;
|
||||||
|
methodpointer:=tmp;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
hpt:=methodpointer;
|
hpt:=methodpointer;
|
||||||
|
|
||||||
|
{ Remove all postfix operators }
|
||||||
while assigned(hpt) and (hpt.nodetype in [subscriptn,vecn]) do
|
while assigned(hpt) and (hpt.nodetype in [subscriptn,vecn]) do
|
||||||
hpt:=tunarynode(hpt).left;
|
hpt:=tunarynode(hpt).left;
|
||||||
|
|
||||||
@ -4038,19 +4057,6 @@ implementation
|
|||||||
e.g. class reference types account }
|
e.g. class reference types account }
|
||||||
hpt:=actualtargetnode(@hpt)^;
|
hpt:=actualtargetnode(@hpt)^;
|
||||||
|
|
||||||
{ if the value a type helper works on is a derefentiation we need to
|
|
||||||
pass the original pointer as Self as the Self value might be
|
|
||||||
changed by the helper }
|
|
||||||
if is_objectpascal_helper(tdef(procdefinition.owner.defowner)) and
|
|
||||||
not is_implicit_pointer_object_type(tobjectdef(procdefinition.owner.defowner).extendeddef) and
|
|
||||||
(hpt.nodetype=derefn) then
|
|
||||||
begin
|
|
||||||
tmp:=tderefnode(hpt).left;
|
|
||||||
tderefnode(hpt).left:=nil;
|
|
||||||
methodpointer.free;
|
|
||||||
methodpointer:=tmp;
|
|
||||||
end;
|
|
||||||
|
|
||||||
{ R.Init then R will be initialized by the constructor,
|
{ R.Init then R will be initialized by the constructor,
|
||||||
Also allow it for simple loads }
|
Also allow it for simple loads }
|
||||||
if (procdefinition.proctypeoption=potype_constructor) or
|
if (procdefinition.proctypeoption=potype_constructor) or
|
||||||
|
19
tests/webtbs/tw38122b.pp
Normal file
19
tests/webtbs/tw38122b.pp
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
program tw38122b;
|
||||||
|
{$mode delphi}
|
||||||
|
uses sysutils;
|
||||||
|
type trec=record
|
||||||
|
i:integer;
|
||||||
|
end;
|
||||||
|
|
||||||
|
var rec:trec;
|
||||||
|
prec:^trec;
|
||||||
|
s: string;
|
||||||
|
begin
|
||||||
|
rec.i:=20;
|
||||||
|
prec:=@rec;
|
||||||
|
s:=prec.i.tostring;
|
||||||
|
//writeln(s);
|
||||||
|
if s<>'20' then
|
||||||
|
halt(1);
|
||||||
|
end.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user