This commit is contained in:
parent
4fbf8389db
commit
484b1a0c4b
13
TestSuite/partial_constructor1.pas
Normal file
13
TestSuite/partial_constructor1.pas
Normal 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.
|
||||||
17
TestSuite/partial_constructor2.pas
Normal file
17
TestSuite/partial_constructor2.pas
Normal 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.
|
||||||
|
|
@ -13757,7 +13757,9 @@ namespace PascalABCCompiler.TreeConverter
|
||||||
if (cmnode != null)
|
if (cmnode != null)
|
||||||
{
|
{
|
||||||
cmnode.is_constructor = true;
|
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)
|
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");
|
AddError(get_location(_procedure_header), "EXTENSION_CONSTRUCTOR_NOT_ALLOWED");
|
||||||
|
|
@ -19373,6 +19375,7 @@ namespace PascalABCCompiler.TreeConverter
|
||||||
gen_constr.is_overload = true;
|
gen_constr.is_overload = true;
|
||||||
gen_constr.is_constructor = true;
|
gen_constr.is_constructor = true;
|
||||||
gen_constr.field_access_level = fn.field_access_level;
|
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;
|
gen_constr.return_value_type = _ctn;
|
||||||
|
|
||||||
foreach (parameter par in fn.parameters)
|
foreach (parameter par in fn.parameters)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue