fcl-passrc: useanalyzer: when member needs typeinfo, mark parent too

This commit is contained in:
mattias 2020-12-08 11:53:10 +00:00
parent a86581a9ea
commit b11d0f692a
2 changed files with 8 additions and 3 deletions

View File

@ -1313,6 +1313,9 @@ begin
UseElement(El,rraNone,true);
UseAttributes(El);
if El.Parent is TPasMembersType then
UseTypeInfo(El.Parent);
end;
procedure TPasAnalyzer.UseAttributes(El: TPasElement);

View File

@ -2685,7 +2685,9 @@ procedure TTestUseAnalyzer.TestWP_Published;
begin
StartProgram(false);
Add('type');
Add(' {#tobject_used}TObject = class');
Add(' {#tobject_notypeinfo}TObject = class');
Add(' end;');
Add(' {#tobject_typeinfo}TBird = class');
Add(' private');
Add(' {#fcol_used}FCol: string;');
Add(' {#fbird_notused}FBird: string;');
@ -2695,9 +2697,9 @@ begin
Add(' property {#col_used}Col: string read FCol;');
Add(' end;');
Add('var');
Add(' {#o_used}o: TObject;');
Add(' {#b_used}b: TBird;');
Add('begin');
Add(' o:=nil;');
Add(' b:=nil;');
AnalyzeWholeProgram;
end;