This commit is contained in:
Ivan Bondarev 2023-02-19 12:23:03 +01:00
parent ccbf5c8d5b
commit 72fe2f7b5e
2 changed files with 21 additions and 1 deletions

19
TestSuite/attributes4.pas Normal file
View file

@ -0,0 +1,19 @@
uses System;
type
attrAttribute = class(Attribute)
constructor (params p1: array of System.Activator);
begin end;
end;
c1 = class
[attr]
f1: integer;
end;
begin
var v1:= new c1;
// ---> Операция '+=' не применима к типам array of Activator и integer <---
v1.f1 += 1;
assert(v1.f1 = 1);
end.

View file

@ -12499,8 +12499,9 @@ namespace PascalABCCompiler.TreeConverter
check_for_strong_constant(cn, get_location(cnstr_args.expressions[i]));
args.AddElement(cn);
}
context.save_var_definitions();
base_function_call bfc = create_constructor_call(tn, args, get_location(attr));
context.restore_var_definitions();
if (ctn is common_type_node && tn == SystemLibrary.SystemLibrary.struct_layout_attribute_type)
{
if ((System.Runtime.InteropServices.LayoutKind)Convert.ToInt32((args[0] as constant_node).get_object_value()) == System.Runtime.InteropServices.LayoutKind.Explicit)