mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-12 23:09:40 +02:00
compiler: fix search of outer class type inside inner type declarations (bug #0017945)
git-svn-id: trunk@16352 -
This commit is contained in:
parent
d99b4ae7c1
commit
a8deeaa168
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -10751,6 +10751,7 @@ tests/webtbs/tw17907/unit2/unit0002.pas svneol=native#text/plain
|
||||
tests/webtbs/tw1792.pp svneol=native#text/plain
|
||||
tests/webtbs/tw17928.pp svneol=native#text/plain
|
||||
tests/webtbs/tw1792a.pp svneol=native#text/plain
|
||||
tests/webtbs/tw17945.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw17950.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw1798.pp svneol=native#text/plain
|
||||
tests/webtbs/tw1820.pp svneol=native#text/plain
|
||||
|
@ -546,23 +546,30 @@ implementation
|
||||
lv,hv : TConstExprInt;
|
||||
old_block_type : tblock_type;
|
||||
dospecialize : boolean;
|
||||
objdef: TDef;
|
||||
begin
|
||||
old_block_type:=block_type;
|
||||
dospecialize:=false;
|
||||
{ use of current parsed object:
|
||||
- classes can be used also in classes
|
||||
- objects can be parameters }
|
||||
if (token=_ID) and
|
||||
assigned(current_objectdef) and
|
||||
(current_objectdef.objname^=pattern) and
|
||||
(
|
||||
(testcurobject=2) or
|
||||
is_class_or_interface_or_objc(current_objectdef)
|
||||
)then
|
||||
if (token=_ID) then
|
||||
begin
|
||||
consume(_ID);
|
||||
def:=current_objectdef;
|
||||
exit;
|
||||
objdef:=current_objectdef;
|
||||
while Assigned(objdef) and (objdef.typ=objectdef) do
|
||||
begin
|
||||
if (tobjectdef(objdef).objname^=pattern) and
|
||||
(
|
||||
(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;
|
||||
{ Generate a specialization? }
|
||||
if try_to_consume(_SPECIALIZE) then
|
||||
|
14
tests/webtbs/tw17945.pp
Normal file
14
tests/webtbs/tw17945.pp
Normal file
@ -0,0 +1,14 @@
|
||||
program tw17945;
|
||||
{$mode delphi}
|
||||
type
|
||||
TFoo = class
|
||||
public
|
||||
type
|
||||
TEnumerator = object
|
||||
private
|
||||
FFoo: TFoo; //Was error: Illegal expression
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
end.
|
Loading…
Reference in New Issue
Block a user