This commit is contained in:
Ivan Bondarev 2021-10-19 21:05:16 +02:00
parent a80c5218a1
commit 0d19f9073f
5 changed files with 50 additions and 0 deletions

View file

@ -877,6 +877,8 @@ namespace PascalABCCompiler.PCU
if (tn is common_type_node)
{
common_namespace_node comp_cnn = (tn as common_type_node).comprehensive_namespace;
if (tn is common_generic_instance_type_node)
comp_cnn = (tn as common_generic_instance_type_node).common_original_generic.comprehensive_namespace;
if (comp_cnn != null && !ns_dict.ContainsKey(comp_cnn) && unit.SemanticTree != comp_cnn.cont_unit)
{
var path = Compiler.GetUnitPath(unit, compiler.UnitsSortedList.Find(u => u.SemanticTree == comp_cnn.cont_unit));
@ -912,6 +914,11 @@ namespace PascalABCCompiler.PCU
common_static_method_call csmc = stmt as common_static_method_call;
AddIndirectUsedUnitsForType(csmc.common_type, ns_dict, interf);
}
else if (stmt is common_method_call)
{
common_method_call cmc = stmt as common_method_call;
AddIndirectUsedUnitsForType(cmc.function_node.cont_type, ns_dict, interf);
}
else if (stmt is if_node)
{
if_node node = stmt as if_node;

View file

@ -0,0 +1,20 @@
unit u_methodcall1;
uses u_methodcall2;
var
i: integer;
procedure p1;
begin
var a: t2 := new t2;
var p := procedure->
begin
a.p1;
Inc(i);
end;
p;
end;
begin
end.

View file

@ -0,0 +1,8 @@
unit u_methodcall2;
uses u_methodcall3;
type
t2 = class(t1<object>) end;
end.

View file

@ -0,0 +1,10 @@
unit u_methodcall3;
type
t1<T> = class
procedure p1 := exit;
end;
end.

View file

@ -0,0 +1,5 @@
uses u_methodcall1;
begin
p1;
assert(i = 1);
end.