mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-15 11:29:34 +02:00
compiler: allow nested objects to refence owner class in method arguments (issue #0017986)
git-svn-id: trunk@16440 -
This commit is contained in:
parent
0c23029d8f
commit
8aef216f21
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -10761,6 +10761,7 @@ tests/webtbs/tw17950.pp svneol=native#text/pascal
|
|||||||
tests/webtbs/tw17952a.pp svneol=native#text/pascal
|
tests/webtbs/tw17952a.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw17952b.pp svneol=native#text/pascal
|
tests/webtbs/tw17952b.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw1798.pp svneol=native#text/plain
|
tests/webtbs/tw1798.pp svneol=native#text/plain
|
||||||
|
tests/webtbs/tw17986.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw17998.pp svneol=native#text/plain
|
tests/webtbs/tw17998.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw18013.pp svneol=native#text/plain
|
tests/webtbs/tw18013.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw1820.pp svneol=native#text/plain
|
tests/webtbs/tw1820.pp svneol=native#text/plain
|
||||||
|
@ -351,6 +351,7 @@ implementation
|
|||||||
srsymtable : TSymtable;
|
srsymtable : TSymtable;
|
||||||
s,sorg : TIDString;
|
s,sorg : TIDString;
|
||||||
t : ttoken;
|
t : ttoken;
|
||||||
|
objdef : tobjectdef;
|
||||||
begin
|
begin
|
||||||
s:=pattern;
|
s:=pattern;
|
||||||
sorg:=orgpattern;
|
sorg:=orgpattern;
|
||||||
@ -358,16 +359,20 @@ implementation
|
|||||||
{ use of current parsed object:
|
{ use of current parsed object:
|
||||||
- classes can be used also in classes
|
- classes can be used also in classes
|
||||||
- objects can be parameters }
|
- objects can be parameters }
|
||||||
if assigned(current_objectdef) and
|
objdef:=current_objectdef;
|
||||||
(current_objectdef.objname^=pattern) and
|
while Assigned(objdef) and (objdef.typ=objectdef) do
|
||||||
(
|
|
||||||
(testcurobject=2) or
|
|
||||||
is_class_or_interface_or_objc(current_objectdef)
|
|
||||||
)then
|
|
||||||
begin
|
begin
|
||||||
consume(_ID);
|
if (tobjectdef(objdef).objname^=pattern) and
|
||||||
def:=current_objectdef;
|
(
|
||||||
exit;
|
(testcurobject=2) or
|
||||||
|
is_class_or_interface_or_objc(objdef)
|
||||||
|
) then
|
||||||
|
begin
|
||||||
|
consume(_ID);
|
||||||
|
def:=objdef;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
objdef:=tobjectdef(tobjectdef(objdef).owner.defowner);
|
||||||
end;
|
end;
|
||||||
{ Use the special searchsym_type that ignores records,objects and
|
{ Use the special searchsym_type that ignores records,objects and
|
||||||
parameters }
|
parameters }
|
||||||
|
20
tests/webtbs/tw17986.pp
Normal file
20
tests/webtbs/tw17986.pp
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
program tw17986;
|
||||||
|
|
||||||
|
{$mode delphi}
|
||||||
|
|
||||||
|
type
|
||||||
|
TFoo1 = class
|
||||||
|
public
|
||||||
|
type
|
||||||
|
TFoo2 = class
|
||||||
|
procedure Proc(value: TFoo1); // was error: Type "TFoo1" is not completely defined
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TFoo1.TFoo2.Proc(value: TFoo1);
|
||||||
|
begin
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
end.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user