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:
svenbarth 2014-04-11 16:13:44 +00:00
parent 256c852631
commit c623824374
3 changed files with 55 additions and 23 deletions

1
.gitattributes vendored
View File

@ -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

View File

@ -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
View 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.