This commit is contained in:
Бондарев Иван 2019-10-03 11:04:30 +02:00
parent cf69fdc20f
commit 1ddc76a614
2 changed files with 21 additions and 1 deletions

17
TestSuite/delegates12.pas Normal file
View file

@ -0,0 +1,17 @@
procedure p := exit;
var i: integer;
procedure p1;
begin
if p = nil then
i := 1
else if nil = p then
i := -1
else
i := 2;
end;
begin
p1;
assert(i = 2);
end.

View file

@ -1246,7 +1246,10 @@ namespace PascalABCCompiler.TreeConverter
base_function_call bfc = ((left as typed_expression).type as delegated_methods).proper_methods[0];
left = convertion_data_and_alghoritms.explicit_convert_type(left, CreateDelegate(bfc.simple_function_node));
sil = left.type.find_in_type(name);
bfc = ((right as typed_expression).type as delegated_methods).proper_methods[0];
if (!(right is typed_expression) && right.type is delegated_methods)
bfc = (right.type as delegated_methods).proper_methods[0];
else
bfc = ((right as typed_expression).type as delegated_methods).proper_methods[0];
right = convertion_data_and_alghoritms.explicit_convert_type(right, CreateDelegate(bfc.simple_function_node));
sil2 = right.type.find_in_type(name);
if (saved_sil != null && sil != null)