This commit is contained in:
Ivan Bondarev 2021-02-07 18:30:55 +01:00
parent 4fbf8389db
commit 484b1a0c4b
3 changed files with 34 additions and 1 deletions

View file

@ -0,0 +1,13 @@
type
t1 = partial class end;
t1 = partial class
constructor(b: integer);
begin
assert(b = 1);
end;
end;
begin
new t1(1);
end.

View file

@ -0,0 +1,17 @@
var i: integer;
type
t1 = partial class
constructor;
begin
i := 1;
end;
end;
t1 = partial class
end;
begin
new t1;
assert(i = 1);
end.

View file

@ -13757,7 +13757,9 @@ namespace PascalABCCompiler.TreeConverter
if (cmnode != null)
{
cmnode.is_constructor = true;
cmnode.return_value_type = context.converted_type;
//context.last_created_function.symbol_kind = symbol_kind.sk_overload_function;
cmnode.is_overload = true;
}
else if (context.top_function is common_namespace_function_node && (context.top_function as common_namespace_function_node).ConnectedToType != null)
AddError(get_location(_procedure_header), "EXTENSION_CONSTRUCTOR_NOT_ALLOWED");
@ -19373,6 +19375,7 @@ namespace PascalABCCompiler.TreeConverter
gen_constr.is_overload = true;
gen_constr.is_constructor = true;
gen_constr.field_access_level = fn.field_access_level;
context.last_created_function.symbol_kind = symbol_kind.sk_overload_function;
gen_constr.return_value_type = _ctn;
foreach (parameter par in fn.parameters)