bug fix #2335
This commit is contained in:
parent
cb6af182a8
commit
80384a89dd
|
|
@ -6,6 +6,6 @@ namespace PascalABCCompiler.PCU
|
|||
{
|
||||
public static class PCUFileFormatVersion
|
||||
{
|
||||
public static System.Int16 Version = 115;
|
||||
public static System.Int16 Version = 116;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2129,6 +2129,8 @@ namespace PascalABCCompiler.PCU
|
|||
//Читаем, является ли тип интерфейсом
|
||||
bool type_is_interface = (br.ReadByte() == 1);
|
||||
|
||||
bool type_is_class = (br.ReadByte() == 1);
|
||||
|
||||
//Читаем, является ли тип делегатом
|
||||
bool type_is_delegate = (br.ReadByte() == 1);
|
||||
|
||||
|
|
@ -2170,14 +2172,7 @@ namespace PascalABCCompiler.PCU
|
|||
type_node base_type = GetTypeReference();
|
||||
bool is_value_type = br.ReadBoolean();
|
||||
|
||||
//Читаем поддерживаемые интерфейсы
|
||||
List<SemanticTree.ITypeNode> interf_implemented = ReadImplementingInterfaces();
|
||||
//int interf_count = br.ReadInt32();
|
||||
//List<SemanticTree.ITypeNode> interf_implemented = new List<SemanticTree.ITypeNode>(interf_count);
|
||||
//for (int i = 0; i < interf_count; i++)
|
||||
//{
|
||||
// interf_implemented.Add(GetTypeReference());
|
||||
//}
|
||||
constant_node low_val = null;
|
||||
constant_node upper_val = null;
|
||||
SemanticTree.type_access_level tal = (SemanticTree.type_access_level)br.ReadByte();
|
||||
|
|
@ -2203,12 +2198,10 @@ namespace PascalABCCompiler.PCU
|
|||
}
|
||||
iscope.TopInterfaceScopeArray = interf_scopes.ToArray();
|
||||
}
|
||||
//ctn = new wrapped_common_type_node(this, base_type, name, tal, cun.namespaces[0], scope, null, offset);
|
||||
//AddMember(ctn, offset);
|
||||
//int_members.Insert(0,ctn);
|
||||
ctn.SetBaseType(base_type);
|
||||
ctn.IsInterface = type_is_interface;
|
||||
ctn.IsDelegate = type_is_delegate;
|
||||
ctn.is_class = type_is_class;
|
||||
ctn.ImplementingInterfaces.AddRange(interf_implemented);
|
||||
ctn.internal_is_value = is_value_type;
|
||||
ctn.type_special_kind = tsk;
|
||||
|
|
@ -2252,7 +2245,6 @@ namespace PascalABCCompiler.PCU
|
|||
}
|
||||
br.ReadInt32();//comprehensive unit;
|
||||
ctn.attributes.AddRange(GetAttributes());
|
||||
//common_namespace_node ns = cun.namespaces[0];
|
||||
byte flag = br.ReadByte();
|
||||
int def_prop_off = 0;
|
||||
if (flag == 1)
|
||||
|
|
@ -2266,10 +2258,6 @@ namespace PascalABCCompiler.PCU
|
|||
SystemLibrary.SystemLibrary.type_constructor.AddOperatorsToDelegate(ctn, loc);
|
||||
}
|
||||
|
||||
//создаем scope для класса
|
||||
//ctn = new wrapped_common_type_node(this, base_type, name, tal, ns, scope, loc, offset);
|
||||
//members[offset] = ctn;
|
||||
//AddMember(ctn, offset);
|
||||
class_names[ctn] = AddClassMemberNames(scope);
|
||||
if (flag == 1) ctn.default_property = GetPropertyNode(def_prop_off);
|
||||
//ivan
|
||||
|
|
@ -2309,11 +2297,6 @@ namespace PascalABCCompiler.PCU
|
|||
ctn.add_internal_interface(dii);
|
||||
}
|
||||
|
||||
/*if (ctn.type_special_kind == PascalABCCompiler.SemanticTree.type_special_kind.array_wrapper)
|
||||
{
|
||||
bounded_array_interface bai = new bounded_array_interface(oti_indexer, ctn.element_type, cpn, oti_indexer.lower_value.type, int_arr);
|
||||
ctn.add_internal_interface(bai);
|
||||
}*/
|
||||
if (type_is_interface)
|
||||
{
|
||||
RestoreAllFields(ctn);
|
||||
|
|
@ -2333,10 +2316,6 @@ namespace PascalABCCompiler.PCU
|
|||
}
|
||||
}
|
||||
}
|
||||
/*if (ctn.type_special_kind == SemanticTree.type_special_kind.array_wrapper)
|
||||
{
|
||||
RestoreAllFields(ctn);
|
||||
}*/
|
||||
|
||||
return ctn;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2508,11 +2508,7 @@ namespace PascalABCCompiler.PCU
|
|||
bw.Write(GetNameIndex(type));
|
||||
else
|
||||
bw.Write(type.name);
|
||||
/*if (type.base_type != null)
|
||||
WriteTypeReference(type.base_type);
|
||||
else*/
|
||||
|
||||
//Пишем, является ли данный класс интерфейсом
|
||||
if (type.IsInterface)
|
||||
{
|
||||
bw.Write((byte)1);
|
||||
|
|
@ -2522,7 +2518,15 @@ namespace PascalABCCompiler.PCU
|
|||
bw.Write((byte)0);
|
||||
}
|
||||
|
||||
//Пишем, является ли данный класс делегатом
|
||||
if (type.is_class)
|
||||
{
|
||||
bw.Write((byte)1);
|
||||
}
|
||||
else
|
||||
{
|
||||
bw.Write((byte)0);
|
||||
}
|
||||
|
||||
if (type.IsDelegate)
|
||||
{
|
||||
bw.Write((byte)1);
|
||||
|
|
@ -2553,9 +2557,6 @@ namespace PascalABCCompiler.PCU
|
|||
|
||||
bw.Seek(GetSizeOfReference(type.base_type), SeekOrigin.Current);
|
||||
|
||||
//(ssyy) На кой чёрт это надо?
|
||||
//WriteTypeReference(SystemLibrary.SystemLibrary.object_type);
|
||||
//WriteTypeReference(type.base_type);
|
||||
bw.Write(type.internal_is_value);
|
||||
|
||||
//Пишем поддерживаемые интерфейсы
|
||||
|
|
@ -2572,6 +2573,7 @@ namespace PascalABCCompiler.PCU
|
|||
bw.Write(type.IsAbstract);
|
||||
bw.Write(type.IsStatic);
|
||||
bw.Write(type.IsPartial);
|
||||
|
||||
if (type.type_special_kind == SemanticTree.type_special_kind.diap_type)
|
||||
{
|
||||
ordinal_type_interface oti = type.get_internal_interface(internal_interface_kind.ordinal_interface) as ordinal_type_interface;
|
||||
|
|
|
|||
|
|
@ -830,4 +830,13 @@ end;
|
|||
|
||||
{$endregion Utils}
|
||||
|
||||
///--
|
||||
procedure __InitModule__;
|
||||
begin
|
||||
end;
|
||||
|
||||
///--
|
||||
procedure __FinalizeModule__;
|
||||
begin
|
||||
end;
|
||||
end.
|
||||
|
|
@ -2776,5 +2776,13 @@ end;
|
|||
{$endregion}
|
||||
|
||||
//----------------------------------------
|
||||
///--
|
||||
procedure __InitModule__;
|
||||
begin
|
||||
end;
|
||||
|
||||
///--
|
||||
procedure __FinalizeModule__;
|
||||
begin
|
||||
end;
|
||||
end.
|
||||
|
|
@ -223,4 +223,15 @@ procedure Tr<T>(a: array of T; transform: T->T) := a.Transform(transform);
|
|||
function H<T>(Self: array of T): integer; extensionmethod := Self.High;
|
||||
|
||||
|
||||
///--
|
||||
procedure __InitModule__;
|
||||
begin
|
||||
end;
|
||||
|
||||
///--
|
||||
procedure __FinalizeModule__;
|
||||
begin
|
||||
end;
|
||||
|
||||
|
||||
end.
|
||||
|
|
@ -755,4 +755,13 @@ end;
|
|||
|
||||
{$endregion}
|
||||
|
||||
///--
|
||||
procedure __InitModule__;
|
||||
begin
|
||||
end;
|
||||
|
||||
///--
|
||||
procedure __FinalizeModule__;
|
||||
begin
|
||||
end;
|
||||
end.
|
||||
7
TestSuite/units/u_questiondot1.pas
Normal file
7
TestSuite/units/u_questiondot1.pas
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
unit u_questiondot1;
|
||||
|
||||
type
|
||||
t1 = class end;
|
||||
|
||||
|
||||
end.
|
||||
7
TestSuite/usesunits/use_questiondot1.pas
Normal file
7
TestSuite/usesunits/use_questiondot1.pas
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
uses u_questiondot1;
|
||||
|
||||
begin
|
||||
var a: t1 := nil;
|
||||
var s := a?.ToString;
|
||||
assert(string.IsNullOrEmpty(s));
|
||||
end.
|
||||
Loading…
Reference in a new issue