This commit is contained in:
Бондарев Иван 2019-10-04 19:28:13 +02:00
parent 6fe9c73545
commit 85f95b0d05
4 changed files with 36 additions and 2 deletions

View file

@ -0,0 +1,11 @@
namespace nspartial;
type
T = partial class
public procedure Test1;
begin
Inc(i);
end;
end;
end.

View file

@ -0,0 +1,12 @@
namespace nspartial;
type
T = partial class
public i: integer;
public procedure Test2;
begin
Inc(i);
end;
end;
end.

View file

@ -0,0 +1,11 @@
//nopabcrtl
{$includenamespace 'namespaces/nspartial1.pas'}
{$includenamespace 'namespaces/nspartial2.pas'}
uses nspartial;
begin
var o := new T;
o.Test1;
o.Test2;
assert(o.i = 2);
end.

View file

@ -10968,9 +10968,9 @@ namespace PascalABCCompiler.TreeConverter
AddError(get_location(cl_def), "TYPE_PREDEFINITION_NOT_ALLOWED");
common_type_node ctn = null;
if (td.type_name is template_type_name)
ctn = context.advanced_create_type(td.type_name.name + "`" + (td.type_name as template_type_name).template_args.Count, get_location(td.type_name), (td.type_def as class_definition).keyword == class_keyword.Interface, false);
ctn = context.advanced_create_type(td.type_name.name + "`" + (td.type_name as template_type_name).template_args.Count, get_location(td.type_name), (td.type_def as class_definition).keyword == class_keyword.Interface, (cl_def.attribute & SyntaxTree.class_attribute.Partial) == SyntaxTree.class_attribute.Partial);
else
ctn = context.advanced_create_type(td.type_name.name, get_location(td.type_name), (td.type_def as class_definition).keyword == class_keyword.Interface, false);
ctn = context.advanced_create_type(td.type_name.name, get_location(td.type_name), (td.type_def as class_definition).keyword == class_keyword.Interface, (cl_def.attribute & SyntaxTree.class_attribute.Partial) == SyntaxTree.class_attribute.Partial);
ctn.ForwardDeclarationOnly = true;
if ((td.type_def as class_definition).keyword == class_keyword.Interface)
ctn.IsInterface = true;