|
@@ -878,7 +878,7 @@ uses
|
|
target_param,
|
|
target_param,
|
|
caller_param : ttypesym;
|
|
caller_param : ttypesym;
|
|
begin
|
|
begin
|
|
- { the target and the caller must the same generic def
|
|
|
|
|
|
+ { the target and the caller must the same generic def
|
|
with the same set of generic parameters }
|
|
with the same set of generic parameters }
|
|
if target_def.genericdef<>caller_def.genericdef then
|
|
if target_def.genericdef<>caller_def.genericdef then
|
|
internalerror(2021020909);
|
|
internalerror(2021020909);
|
|
@@ -904,15 +904,15 @@ uses
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
- { specialize arrays by using element types but arrays may be multi-dimensional
|
|
|
|
|
|
+ { specialize arrays by using element types but arrays may be multi-dimensional
|
|
so we need to examine the caller/target pairs recursively in order to
|
|
so we need to examine the caller/target pairs recursively in order to
|
|
verify the dimensionality is equal }
|
|
verify the dimensionality is equal }
|
|
function handle_arrays(owner:tprocdef;target_def,caller_def:tarraydef;out target_element,caller_element:tdef):boolean;
|
|
function handle_arrays(owner:tprocdef;target_def,caller_def:tarraydef;out target_element,caller_element:tdef):boolean;
|
|
begin
|
|
begin
|
|
- { the target and the caller are both arrays and the target is a
|
|
|
|
|
|
+ { the target and the caller are both arrays and the target is a
|
|
specialization so we can recurse into the targets element def }
|
|
specialization so we can recurse into the targets element def }
|
|
- if is_array_literal(target_def.elementdef) and
|
|
|
|
- is_array_literal(caller_def.elementdef) and
|
|
|
|
|
|
+ if is_array_literal(target_def.elementdef) and
|
|
|
|
+ is_array_literal(caller_def.elementdef) and
|
|
target_def.is_specialization then
|
|
target_def.is_specialization then
|
|
result:=handle_arrays(owner,tarraydef(target_def.elementdef),tarraydef(caller_def.elementdef),target_element,caller_element)
|
|
result:=handle_arrays(owner,tarraydef(target_def.elementdef),tarraydef(caller_def.elementdef),target_element,caller_element)
|
|
else
|
|
else
|
|
@@ -1128,7 +1128,7 @@ uses
|
|
exit;
|
|
exit;
|
|
end;
|
|
end;
|
|
|
|
|
|
- { check to make sure the generic parameters are all used
|
|
|
|
|
|
+ { check to make sure the generic parameters are all used
|
|
at least once in the caller parameters. }
|
|
at least once in the caller parameters. }
|
|
count:=0;
|
|
count:=0;
|
|
for i:=0 to genericdef.genericparas.count-1 do
|
|
for i:=0 to genericdef.genericparas.count-1 do
|
|
@@ -1157,7 +1157,7 @@ uses
|
|
target_def:=tparavarsym(paras[i]).vardef;
|
|
target_def:=tparavarsym(paras[i]).vardef;
|
|
target_key:='';
|
|
target_key:='';
|
|
|
|
|
|
- { strings are compatible with "array of T" so we
|
|
|
|
|
|
+ { strings are compatible with "array of T" so we
|
|
need to use the element type for specialization }
|
|
need to use the element type for specialization }
|
|
if is_stringlike(caller_def) and
|
|
if is_stringlike(caller_def) and
|
|
is_array_literal(target_def) and
|
|
is_array_literal(target_def) and
|
|
@@ -1167,10 +1167,10 @@ uses
|
|
target_key:=generic_param_hash(target_def);
|
|
target_key:=generic_param_hash(target_def);
|
|
caller_def:=chartype_for_stringlike(caller_def);
|
|
caller_def:=chartype_for_stringlike(caller_def);
|
|
end
|
|
end
|
|
- { non-uniform array constructors (i.e. array of const) are not compatible
|
|
|
|
|
|
+ { non-uniform array constructors (i.e. array of const) are not compatible
|
|
with normal arrays like "array of T" so we reject them }
|
|
with normal arrays like "array of T" so we reject them }
|
|
else if is_array_literal(target_def) and
|
|
else if is_array_literal(target_def) and
|
|
- (caller_def.typ=arraydef) and
|
|
|
|
|
|
+ (caller_def.typ=arraydef) and
|
|
(ado_IsConstructor in tarraydef(caller_def).arrayoptions) and
|
|
(ado_IsConstructor in tarraydef(caller_def).arrayoptions) and
|
|
(ado_IsArrayOfConst in tarraydef(caller_def).arrayoptions) then
|
|
(ado_IsArrayOfConst in tarraydef(caller_def).arrayoptions) then
|
|
begin
|
|
begin
|
|
@@ -1186,15 +1186,15 @@ uses
|
|
target_key:=generic_param_hash(target_def);
|
|
target_key:=generic_param_hash(target_def);
|
|
end
|
|
end
|
|
{ handle generic procvars }
|
|
{ handle generic procvars }
|
|
- else if (caller_def.typ=procvardef) and
|
|
|
|
- (target_def.typ=procvardef) and
|
|
|
|
|
|
+ else if (caller_def.typ=procvardef) and
|
|
|
|
+ (target_def.typ=procvardef) and
|
|
tprocvardef(target_def).is_specialization and
|
|
tprocvardef(target_def).is_specialization and
|
|
handle_procvars(genericparams,callerparams,target_def,caller_def) then
|
|
handle_procvars(genericparams,callerparams,target_def,caller_def) then
|
|
begin
|
|
begin
|
|
continue;
|
|
continue;
|
|
end
|
|
end
|
|
- { handle specialized objects by taking the base class as the type to specialize }
|
|
|
|
- else if is_class_or_object(caller_def) and
|
|
|
|
|
|
+ { handle specialized objects by taking the base class as the type to specialize }
|
|
|
|
+ else if is_class_or_object(caller_def) and
|
|
is_class_or_object(target_def) and
|
|
is_class_or_object(target_def) and
|
|
genericdef.is_generic_param(target_def) then
|
|
genericdef.is_generic_param(target_def) then
|
|
begin
|
|
begin
|
|
@@ -1272,7 +1272,7 @@ uses
|
|
end;
|
|
end;
|
|
|
|
|
|
var
|
|
var
|
|
- i,j : integer;
|
|
|
|
|
|
+ i,j,k : integer;
|
|
srsym : tprocsym;
|
|
srsym : tprocsym;
|
|
callerparams : tfplist;
|
|
callerparams : tfplist;
|
|
pd : tprocdef;
|
|
pd : tprocdef;
|