This commit is contained in:
Бондарев Иван 2018-07-16 20:41:07 +02:00
parent dd398c68c4
commit 5597d0ef2f
2 changed files with 32 additions and 1 deletions

View file

@ -6919,7 +6919,7 @@ namespace PascalABCCompiler.NETGenerator
{
il.Emit(OpCodes.Box, helper.GetTypeReference(value.obj.conversion_type).tp);
}
else if (value.obj.type.is_value_type && !(value.obj is IAddressedExpressionNode) && !(value.obj is IThisNode) && !(value.obj is ICommonMethodCallNode) && !(value.obj is ICommonConstructorCall))
else if (value.obj.type.is_value_type && !(value.obj is IAddressedExpressionNode) && !(value.obj is IThisNode) && !(value.obj is ICommonMethodCallNode) && !(value.obj is ICommonStaticMethodCallNode) && !(value.obj is ICommonConstructorCall) && !(value.obj is ICommonNamespaceFunctionCallNode) && !(value.obj is ICommonNestedInFunctionFunctionCallNode))
{
LocalBuilder lb = il.DeclareLocal(helper.GetTypeReference(value.obj.type).tp);
il.Emit(OpCodes.Stloc, lb);

31
TestSuite/records10.pas Normal file
View file

@ -0,0 +1,31 @@
type
r1 = record
public X, Y: integer;
public constructor create(X, Y: integer);
begin
self.X := X;
self.Y := Y;
end;
public function f1 := self.X;
class function GetR1 := new r1(3, 4);
end;
function GetR1 := new r1(1, 2);
procedure test;
function NestedGetR1 := new r1(1, 2);
begin
assert(NestedGetR1.f1 = 1);
end;
begin
assert(GetR1.f1 = 1);
assert(r1.GetR1.f1 = 3);
test;
end.