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/tw25598.pp svneol=native#text/plain
tests/webtbs/tw25600.pp svneol=native#text/pascal tests/webtbs/tw25600.pp svneol=native#text/pascal
tests/webtbs/tw25603.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/tw2561.pp svneol=native#text/plain
tests/webtbs/tw25610.pp -text svneol=native#text/plain tests/webtbs/tw25610.pp -text svneol=native#text/plain
tests/webtbs/tw25685.pp svneol=native#text/pascal tests/webtbs/tw25685.pp svneol=native#text/pascal

View File

@ -3195,29 +3195,42 @@ implementation
if srsym<>nil then if srsym<>nil then
begin begin
if srsym.typ=propertysym then case srsym.typ of
begin procsym:
result:=true; begin
exit; for i:=0 to tprocsym(srsym).procdeflist.count-1 do
end; begin
for i:=0 to tprocsym(srsym).procdeflist.count-1 do pdef:=tprocdef(tprocsym(srsym).procdeflist[i]);
begin if not is_visible_for_object(pdef.owner,pdef.visibility,contextclassh) then
pdef:=tprocdef(tprocsym(srsym).procdeflist[i]); continue;
if not is_visible_for_object(pdef.owner,pdef.visibility,contextclassh) then { we need to know if a procedure references symbols
continue; in the static symtable, because then it can't be
{ we need to know if a procedure references symbols inlined from outside this unit }
in the static symtable, because then it can't be if assigned(current_procinfo) and
inlined from outside this unit } (srsym.owner.symtabletype=staticsymtable) then
if assigned(current_procinfo) and include(current_procinfo.flags,pi_uses_static_symtable);
(srsym.owner.symtabletype=staticsymtable) then { the first found method wins }
include(current_procinfo.flags,pi_uses_static_symtable); srsym:=tprocdef(tprocsym(srsym).procdeflist[i]).procsym;
{ the first found method wins } srsymtable:=srsym.owner;
srsym:=tprocdef(tprocsym(srsym).procdeflist[i]).procsym; addsymref(srsym);
srsymtable:=srsym.owner; result:=true;
addsymref(srsym); exit;
result:=true; end;
exit; end;
end; typesym,
fieldvarsym,
constsym,
enumsym,
undefinedsym,
propertysym:
begin
addsymref(srsym);
result:=true;
exit;
end;
else
internalerror(2014041101);
end;
end; end;
{ try the helper parent if available } { 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.