mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-16 17:29:53 +02:00
fcl-passrc: useanalyzer: wpo generic
git-svn-id: trunk@42827 -
This commit is contained in:
parent
1168083dfe
commit
b3465a021c
@ -26571,8 +26571,13 @@ begin
|
||||
inc(Result);
|
||||
end
|
||||
else if SrcType.ClassType=TPasSpecializeType then
|
||||
begin
|
||||
// specialize -> skip
|
||||
SrcType:=TPasSpecializeType(SrcType).DestType
|
||||
if SrcType.CustomData is TPasSpecializeTypeData then
|
||||
SrcType:=TPasSpecializeTypeData(SrcType.CustomData).SpecializedType
|
||||
else
|
||||
SrcType:=TPasSpecializeType(SrcType).DestType;
|
||||
end
|
||||
else if SrcType.ClassType=TPasClassType then
|
||||
begin
|
||||
ClassEl:=TPasClassType(SrcType);
|
||||
|
@ -1010,14 +1010,34 @@ begin
|
||||
end;
|
||||
|
||||
function TPasAnalyzer.CanSkipGenericType(El: TPasGenericType): boolean;
|
||||
|
||||
procedure RaiseHalfSpecialized;
|
||||
var
|
||||
GenScope: TPasGenericScope;
|
||||
Item: TPSSpecializedItem;
|
||||
begin
|
||||
if (El.GenericTemplateTypes<>nil) and (El.GenericTemplateTypes.Count>0) then
|
||||
RaiseNotSupported(20190817151437,El);
|
||||
if not (El.CustomData is TPasGenericScope) then
|
||||
RaiseNotSupported(20190826141320,El,GetObjName(El.CustomData));
|
||||
GenScope:=TPasGenericScope(El.CustomData);
|
||||
Item:=GenScope.SpecializedItem;
|
||||
if Item=nil then
|
||||
RaiseNotSupported(20190826141352,El);
|
||||
if Item.SpecializedType=nil then
|
||||
RaiseNotSupported(20190826141516,El);
|
||||
if Item.FirstSpecialize=nil then
|
||||
RaiseNotSupported(20190826141649,El);
|
||||
RaiseNotSupported(20190826141540,El,'SpecializedAt:'+GetObjPath(Item.FirstSpecialize)+' '+Resolver.GetElementSourcePosStr(Item.FirstSpecialize));
|
||||
end;
|
||||
|
||||
begin
|
||||
Result:=false;
|
||||
if ScopeModule=nil then
|
||||
begin
|
||||
// analyze whole program
|
||||
// -> should only reach fully specialized types
|
||||
if not Resolver.IsFullySpecialized(El) then
|
||||
RaiseNotSupported(20190817151437,El);
|
||||
RaiseHalfSpecialized;
|
||||
end
|
||||
else
|
||||
begin
|
||||
@ -2058,11 +2078,11 @@ var
|
||||
aClass: TPasClassType;
|
||||
begin
|
||||
FirstTime:=true;
|
||||
if CanSkipGenericType(El) then exit;
|
||||
case Mode of
|
||||
paumAllExports: exit;
|
||||
paumAllPasUsable:
|
||||
begin
|
||||
if CanSkipGenericType(El) then exit;
|
||||
if MarkElementAsUsed(El) then
|
||||
ElementVisited(El,Mode)
|
||||
else
|
||||
@ -2075,7 +2095,10 @@ begin
|
||||
end;
|
||||
end;
|
||||
paumElement:
|
||||
begin
|
||||
if CanSkipGenericType(El) then exit;
|
||||
if not MarkElementAsUsed(El) then exit;
|
||||
end
|
||||
else
|
||||
RaiseInconsistency(20170414152143,IntToStr(ord(Mode)));
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user