mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-10 14:26:00 +02:00
Fix for Mantis #25605.
symtable.pas, search_objectpascal_helper: * handle more symbol types than just properties and methods; afterall helpers can have types, static variables and constants as well + added test git-svn-id: trunk@27534 -
This commit is contained in:
parent
256c852631
commit
c623824374
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -13900,6 +13900,7 @@ tests/webtbs/tw25551.pp svneol=native#text/plain
|
||||
tests/webtbs/tw25598.pp svneol=native#text/plain
|
||||
tests/webtbs/tw25600.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw25603.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw25605.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw2561.pp svneol=native#text/plain
|
||||
tests/webtbs/tw25610.pp -text svneol=native#text/plain
|
||||
tests/webtbs/tw25685.pp svneol=native#text/pascal
|
||||
|
@ -3195,29 +3195,42 @@ implementation
|
||||
|
||||
if srsym<>nil then
|
||||
begin
|
||||
if srsym.typ=propertysym then
|
||||
begin
|
||||
result:=true;
|
||||
exit;
|
||||
end;
|
||||
for i:=0 to tprocsym(srsym).procdeflist.count-1 do
|
||||
begin
|
||||
pdef:=tprocdef(tprocsym(srsym).procdeflist[i]);
|
||||
if not is_visible_for_object(pdef.owner,pdef.visibility,contextclassh) then
|
||||
continue;
|
||||
{ we need to know if a procedure references symbols
|
||||
in the static symtable, because then it can't be
|
||||
inlined from outside this unit }
|
||||
if assigned(current_procinfo) and
|
||||
(srsym.owner.symtabletype=staticsymtable) then
|
||||
include(current_procinfo.flags,pi_uses_static_symtable);
|
||||
{ the first found method wins }
|
||||
srsym:=tprocdef(tprocsym(srsym).procdeflist[i]).procsym;
|
||||
srsymtable:=srsym.owner;
|
||||
addsymref(srsym);
|
||||
result:=true;
|
||||
exit;
|
||||
end;
|
||||
case srsym.typ of
|
||||
procsym:
|
||||
begin
|
||||
for i:=0 to tprocsym(srsym).procdeflist.count-1 do
|
||||
begin
|
||||
pdef:=tprocdef(tprocsym(srsym).procdeflist[i]);
|
||||
if not is_visible_for_object(pdef.owner,pdef.visibility,contextclassh) then
|
||||
continue;
|
||||
{ we need to know if a procedure references symbols
|
||||
in the static symtable, because then it can't be
|
||||
inlined from outside this unit }
|
||||
if assigned(current_procinfo) and
|
||||
(srsym.owner.symtabletype=staticsymtable) then
|
||||
include(current_procinfo.flags,pi_uses_static_symtable);
|
||||
{ the first found method wins }
|
||||
srsym:=tprocdef(tprocsym(srsym).procdeflist[i]).procsym;
|
||||
srsymtable:=srsym.owner;
|
||||
addsymref(srsym);
|
||||
result:=true;
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
typesym,
|
||||
fieldvarsym,
|
||||
constsym,
|
||||
enumsym,
|
||||
undefinedsym,
|
||||
propertysym:
|
||||
begin
|
||||
addsymref(srsym);
|
||||
result:=true;
|
||||
exit;
|
||||
end;
|
||||
else
|
||||
internalerror(2014041101);
|
||||
end;
|
||||
end;
|
||||
|
||||
{ try the helper parent if available }
|
||||
|
18
tests/webtbs/tw25605.pp
Normal file
18
tests/webtbs/tw25605.pp
Normal file
@ -0,0 +1,18 @@
|
||||
{ %NORUN }
|
||||
|
||||
program tw25605; // Fatal: Compilation aborted
|
||||
|
||||
{$MODE DELPHI}
|
||||
{$modeswitch typehelpers}
|
||||
|
||||
type
|
||||
TValueInt32Helper = record helper for Int32
|
||||
const
|
||||
C: Int32 = 0;
|
||||
end;
|
||||
|
||||
var
|
||||
I: Int32;
|
||||
begin
|
||||
I := Int32.C;
|
||||
end.
|
Loading…
Reference in New Issue
Block a user