From 0664033ee2a7f439200faef9c3d3762f40e7815d Mon Sep 17 00:00:00 2001 From: Ivan Bondarev Date: Sun, 8 May 2022 11:41:12 +0200 Subject: [PATCH] #2663 --- TestSuite/units/u_records7.pas | 20 +++++++++++++++++++ TestSuite/usesunits/use_records7.pas | 4 ++++ .../TreeRealization/functions_calls.cs | 10 +++++++--- 3 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 TestSuite/units/u_records7.pas create mode 100644 TestSuite/usesunits/use_records7.pas diff --git a/TestSuite/units/u_records7.pas b/TestSuite/units/u_records7.pas new file mode 100644 index 000000000..21e81aa7e --- /dev/null +++ b/TestSuite/units/u_records7.pas @@ -0,0 +1,20 @@ +unit u_records6; + +type + intr = interface + procedure p; + end; + + r = record(intr) + // Обязательно использовать тот же конструктор, что и в p1 + procedure p := new r; + end; + +// Обязательно принимать интерфейс +procedure p0(o: intr) := exit; + +// Обязательно передать экземпляр r, не присвоенный ни одной переменной +// (можно использовать как простой обход) +procedure p1 := p0(new r); + +end. \ No newline at end of file diff --git a/TestSuite/usesunits/use_records7.pas b/TestSuite/usesunits/use_records7.pas new file mode 100644 index 000000000..8239bd5d4 --- /dev/null +++ b/TestSuite/usesunits/use_records7.pas @@ -0,0 +1,4 @@ +uses u_records7; +begin + p1; +end. \ No newline at end of file diff --git a/TreeConverter/TreeRealization/functions_calls.cs b/TreeConverter/TreeRealization/functions_calls.cs index 64ea69fdc..ca7f2452f 100644 --- a/TreeConverter/TreeRealization/functions_calls.cs +++ b/TreeConverter/TreeRealization/functions_calls.cs @@ -472,7 +472,7 @@ namespace PascalABCCompiler.TreeRealization [Serializable] public class common_static_method_call : base_function_call_with_method, SemanticTree.ICommonStaticMethodCallNode { - private common_type_node _common_type; + private common_type_node _common_type;//zachem dublirovat svojstvo iz common_method_node???? public common_static_method_call(common_method_node static_method,location loc) : base(static_method,loc) @@ -486,7 +486,9 @@ namespace PascalABCCompiler.TreeRealization { get { - return _common_type; + if (_common_type != null) + return _common_type; + return function_node.cont_type; } } @@ -508,7 +510,9 @@ namespace PascalABCCompiler.TreeRealization { get { - return _common_type; + if (_common_type != null) + return _common_type; + return function_node.cont_type; } }