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 class PCUFileFormatVersion
|
||||||
{
|
{
|
||||||
public static System.Int16 Version = 115;
|
public static System.Int16 Version = 116;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2107,8 +2107,8 @@ namespace PascalABCCompiler.PCU
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
private definition_node CreateInterfaceCommonType(string name, int offset)
|
private definition_node CreateInterfaceCommonType(string name, int offset)
|
||||||
{
|
{
|
||||||
definition_node dn = null;
|
definition_node dn = null;
|
||||||
if (members.TryGetValue(offset, out dn))
|
if (members.TryGetValue(offset, out dn))
|
||||||
return dn as common_type_node;
|
return dn as common_type_node;
|
||||||
|
|
@ -2116,7 +2116,7 @@ namespace PascalABCCompiler.PCU
|
||||||
|
|
||||||
bool is_interface = br.ReadBoolean();
|
bool is_interface = br.ReadBoolean();
|
||||||
int ind = br.ReadInt32();
|
int ind = br.ReadInt32();
|
||||||
|
|
||||||
if (is_interface)//пропускаем флаг - интерфейсности
|
if (is_interface)//пропускаем флаг - интерфейсности
|
||||||
{
|
{
|
||||||
name = GetString(br.ReadInt32());
|
name = GetString(br.ReadInt32());
|
||||||
|
|
@ -2125,10 +2125,12 @@ namespace PascalABCCompiler.PCU
|
||||||
{
|
{
|
||||||
name = br.ReadString();
|
name = br.ReadString();
|
||||||
}
|
}
|
||||||
//br.ReadInt32();
|
//br.ReadInt32();
|
||||||
//Читаем, является ли тип интерфейсом
|
//Читаем, является ли тип интерфейсом
|
||||||
bool type_is_interface = (br.ReadByte() == 1);
|
bool type_is_interface = (br.ReadByte() == 1);
|
||||||
|
|
||||||
|
bool type_is_class = (br.ReadByte() == 1);
|
||||||
|
|
||||||
//Читаем, является ли тип делегатом
|
//Читаем, является ли тип делегатом
|
||||||
bool type_is_delegate = (br.ReadByte() == 1);
|
bool type_is_delegate = (br.ReadByte() == 1);
|
||||||
|
|
||||||
|
|
@ -2164,35 +2166,28 @@ namespace PascalABCCompiler.PCU
|
||||||
ctn.generic_params = type_params;
|
ctn.generic_params = type_params;
|
||||||
}
|
}
|
||||||
AddMember(ctn, offset);
|
AddMember(ctn, offset);
|
||||||
|
|
||||||
int_members.Insert(0,ctn);
|
int_members.Insert(0, ctn);
|
||||||
common_type_node saved_ctn = ctn;
|
common_type_node saved_ctn = ctn;
|
||||||
type_node base_type = GetTypeReference();
|
type_node base_type = GetTypeReference();
|
||||||
bool is_value_type = br.ReadBoolean();
|
bool is_value_type = br.ReadBoolean();
|
||||||
|
|
||||||
//Читаем поддерживаемые интерфейсы
|
|
||||||
List<SemanticTree.ITypeNode> interf_implemented = ReadImplementingInterfaces();
|
List<SemanticTree.ITypeNode> interf_implemented = ReadImplementingInterfaces();
|
||||||
//int interf_count = br.ReadInt32();
|
constant_node low_val = null;
|
||||||
//List<SemanticTree.ITypeNode> interf_implemented = new List<SemanticTree.ITypeNode>(interf_count);
|
constant_node upper_val = null;
|
||||||
//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();
|
SemanticTree.type_access_level tal = (SemanticTree.type_access_level)br.ReadByte();
|
||||||
SemanticTree.type_special_kind tsk = (SemanticTree.type_special_kind)br.ReadByte();
|
SemanticTree.type_special_kind tsk = (SemanticTree.type_special_kind)br.ReadByte();
|
||||||
ctn.SetIsSealed(br.ReadBoolean());
|
ctn.SetIsSealed(br.ReadBoolean());
|
||||||
ctn.SetIsAbstract(br.ReadBoolean());
|
ctn.SetIsAbstract(br.ReadBoolean());
|
||||||
ctn.SetIsStatic(br.ReadBoolean());
|
ctn.SetIsStatic(br.ReadBoolean());
|
||||||
ctn.IsPartial = br.ReadBoolean();
|
ctn.IsPartial = br.ReadBoolean();
|
||||||
|
|
||||||
if (tsk == SemanticTree.type_special_kind.diap_type)
|
if (tsk == SemanticTree.type_special_kind.diap_type)
|
||||||
{
|
{
|
||||||
low_val = CreateExpression() as constant_node;
|
low_val = CreateExpression() as constant_node;
|
||||||
upper_val = CreateExpression() as constant_node;
|
upper_val = CreateExpression() as constant_node;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type_is_interface)
|
if (type_is_interface)
|
||||||
{
|
{
|
||||||
//Добавляем ссылки на области видимости предков интерфейса
|
//Добавляем ссылки на области видимости предков интерфейса
|
||||||
|
|
@ -2203,12 +2198,10 @@ namespace PascalABCCompiler.PCU
|
||||||
}
|
}
|
||||||
iscope.TopInterfaceScopeArray = interf_scopes.ToArray();
|
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.SetBaseType(base_type);
|
||||||
ctn.IsInterface = type_is_interface;
|
ctn.IsInterface = type_is_interface;
|
||||||
ctn.IsDelegate = type_is_delegate;
|
ctn.IsDelegate = type_is_delegate;
|
||||||
|
ctn.is_class = type_is_class;
|
||||||
ctn.ImplementingInterfaces.AddRange(interf_implemented);
|
ctn.ImplementingInterfaces.AddRange(interf_implemented);
|
||||||
ctn.internal_is_value = is_value_type;
|
ctn.internal_is_value = is_value_type;
|
||||||
ctn.type_special_kind = tsk;
|
ctn.type_special_kind = tsk;
|
||||||
|
|
@ -2226,13 +2219,13 @@ namespace PascalABCCompiler.PCU
|
||||||
if (CanReadObject())
|
if (CanReadObject())
|
||||||
elemnet_type = GetTypeReference();
|
elemnet_type = GetTypeReference();
|
||||||
ctn.element_type = elemnet_type;
|
ctn.element_type = elemnet_type;
|
||||||
if (ctn.type_special_kind != SemanticTree.type_special_kind.set_type)
|
if (ctn.type_special_kind != SemanticTree.type_special_kind.set_type)
|
||||||
{
|
{
|
||||||
SystemLibrary.SystemLibrary.init_reference_type(ctn);
|
SystemLibrary.SystemLibrary.init_reference_type(ctn);
|
||||||
}
|
}
|
||||||
if (ctn.type_special_kind == SemanticTree.type_special_kind.set_type)
|
if (ctn.type_special_kind == SemanticTree.type_special_kind.set_type)
|
||||||
{
|
{
|
||||||
ctn = compilation_context.AddTypeToSetTypeList(ctn);
|
ctn = compilation_context.AddTypeToSetTypeList(ctn);
|
||||||
if (saved_ctn != ctn)
|
if (saved_ctn != ctn)
|
||||||
{
|
{
|
||||||
RemoveMember(offset, saved_ctn);
|
RemoveMember(offset, saved_ctn);
|
||||||
|
|
@ -2242,7 +2235,7 @@ namespace PascalABCCompiler.PCU
|
||||||
}
|
}
|
||||||
if (ctn.type_special_kind == SemanticTree.type_special_kind.typed_file)
|
if (ctn.type_special_kind == SemanticTree.type_special_kind.typed_file)
|
||||||
{
|
{
|
||||||
ctn = compilation_context.AddTypeToTypedFileList(ctn);
|
ctn = compilation_context.AddTypeToTypedFileList(ctn);
|
||||||
if (saved_ctn != ctn)
|
if (saved_ctn != ctn)
|
||||||
{
|
{
|
||||||
RemoveMember(offset, saved_ctn);
|
RemoveMember(offset, saved_ctn);
|
||||||
|
|
@ -2252,50 +2245,45 @@ namespace PascalABCCompiler.PCU
|
||||||
}
|
}
|
||||||
br.ReadInt32();//comprehensive unit;
|
br.ReadInt32();//comprehensive unit;
|
||||||
ctn.attributes.AddRange(GetAttributes());
|
ctn.attributes.AddRange(GetAttributes());
|
||||||
//common_namespace_node ns = cun.namespaces[0];
|
|
||||||
byte flag = br.ReadByte();
|
byte flag = br.ReadByte();
|
||||||
int def_prop_off=0;
|
int def_prop_off = 0;
|
||||||
if (flag == 1)
|
if (flag == 1)
|
||||||
{
|
{
|
||||||
def_prop_off = br.ReadInt32();
|
def_prop_off = br.ReadInt32();
|
||||||
}
|
}
|
||||||
location loc= ReadDebugInfo();
|
location loc = ReadDebugInfo();
|
||||||
ctn.loc = loc;
|
ctn.loc = loc;
|
||||||
if (type_is_delegate)
|
if (type_is_delegate)
|
||||||
{
|
{
|
||||||
SystemLibrary.SystemLibrary.type_constructor.AddOperatorsToDelegate(ctn, loc);
|
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);
|
class_names[ctn] = AddClassMemberNames(scope);
|
||||||
if (flag == 1) ctn.default_property = GetPropertyNode(def_prop_off);
|
if (flag == 1) ctn.default_property = GetPropertyNode(def_prop_off);
|
||||||
//ivan
|
//ivan
|
||||||
if (ctn.IsEnum)
|
if (ctn.IsEnum)
|
||||||
{
|
{
|
||||||
AddEnumOperators(ctn);
|
AddEnumOperators(ctn);
|
||||||
MakeTypeAsOrdinal(ctn,0,class_names.Count);
|
MakeTypeAsOrdinal(ctn, 0, class_names.Count);
|
||||||
ctn.add_additional_enum_operations();
|
ctn.add_additional_enum_operations();
|
||||||
}
|
}
|
||||||
if (ctn.type_special_kind == SemanticTree.type_special_kind.diap_type)
|
if (ctn.type_special_kind == SemanticTree.type_special_kind.diap_type)
|
||||||
{
|
{
|
||||||
type_constructor.add_convertions_to_diap(ctn,low_val,upper_val);
|
type_constructor.add_convertions_to_diap(ctn, low_val, upper_val);
|
||||||
}
|
}
|
||||||
if (ctn.type_special_kind == SemanticTree.type_special_kind.array_kind)
|
if (ctn.type_special_kind == SemanticTree.type_special_kind.array_kind)
|
||||||
{
|
{
|
||||||
if (!(ctn.element_type is compiled_type_node))
|
if (!(ctn.element_type is compiled_type_node))
|
||||||
{
|
{
|
||||||
type_constructor.make_array_interface(ctn);
|
type_constructor.make_array_interface(ctn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ctn.is_value_type)
|
if (ctn.is_value_type)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
//RestoreAllFields(ctn);
|
//RestoreAllFields(ctn);
|
||||||
if(!waited_types_to_restore_fields.Contains(ctn))
|
if (!waited_types_to_restore_fields.Contains(ctn))
|
||||||
waited_types_to_restore_fields.Add(ctn);
|
waited_types_to_restore_fields.Add(ctn);
|
||||||
|
|
||||||
if (type_is_delegate)
|
if (type_is_delegate)
|
||||||
|
|
@ -2308,19 +2296,14 @@ namespace PascalABCCompiler.PCU
|
||||||
dii.parameters.AddRange(invoke_method.parameters);
|
dii.parameters.AddRange(invoke_method.parameters);
|
||||||
ctn.add_internal_interface(dii);
|
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)
|
if (type_is_interface)
|
||||||
{
|
{
|
||||||
RestoreAllFields(ctn);
|
RestoreAllFields(ctn);
|
||||||
}
|
}
|
||||||
if (ctn.is_value)
|
if (ctn.is_value)
|
||||||
{
|
{
|
||||||
RestoreAllFields(ctn);
|
RestoreAllFields(ctn);
|
||||||
}
|
}
|
||||||
if (ctn.is_generic_type_definition)
|
if (ctn.is_generic_type_definition)
|
||||||
{
|
{
|
||||||
|
|
@ -2333,13 +2316,9 @@ namespace PascalABCCompiler.PCU
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*if (ctn.type_special_kind == SemanticTree.type_special_kind.array_wrapper)
|
|
||||||
{
|
return ctn;
|
||||||
RestoreAllFields(ctn);
|
}
|
||||||
}*/
|
|
||||||
|
|
||||||
return ctn;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void MakeTypeAsOrdinal(common_type_node ctn, int low_val, int upper_val)
|
private void MakeTypeAsOrdinal(common_type_node ctn, int low_val, int upper_val)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2496,23 +2496,19 @@ namespace PascalABCCompiler.PCU
|
||||||
return sizeof(byte) + sizeof(int);
|
return sizeof(byte) + sizeof(int);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void VisitTypeDefinition(common_type_node type)
|
private void VisitTypeDefinition(common_type_node type)
|
||||||
{
|
{
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
if (is_interface == true) offset = SavePositionAndConstPool(type);
|
if (is_interface == true) offset = SavePositionAndConstPool(type);
|
||||||
else offset = SavePositionAndImplementationPool(type);
|
else offset = SavePositionAndImplementationPool(type);
|
||||||
bw.Write((byte)type.semantic_node_type);
|
bw.Write((byte)type.semantic_node_type);
|
||||||
bw.Write(is_interface);
|
bw.Write(is_interface);
|
||||||
bw.Write(type_entity_index++);
|
bw.Write(type_entity_index++);
|
||||||
if (is_interface == true)
|
if (is_interface == true)
|
||||||
bw.Write(GetNameIndex(type));
|
bw.Write(GetNameIndex(type));
|
||||||
else
|
else
|
||||||
bw.Write(type.name);
|
bw.Write(type.name);
|
||||||
/*if (type.base_type != null)
|
|
||||||
WriteTypeReference(type.base_type);
|
|
||||||
else*/
|
|
||||||
|
|
||||||
//Пишем, является ли данный класс интерфейсом
|
|
||||||
if (type.IsInterface)
|
if (type.IsInterface)
|
||||||
{
|
{
|
||||||
bw.Write((byte)1);
|
bw.Write((byte)1);
|
||||||
|
|
@ -2522,7 +2518,15 @@ namespace PascalABCCompiler.PCU
|
||||||
bw.Write((byte)0);
|
bw.Write((byte)0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Пишем, является ли данный класс делегатом
|
if (type.is_class)
|
||||||
|
{
|
||||||
|
bw.Write((byte)1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bw.Write((byte)0);
|
||||||
|
}
|
||||||
|
|
||||||
if (type.IsDelegate)
|
if (type.IsDelegate)
|
||||||
{
|
{
|
||||||
bw.Write((byte)1);
|
bw.Write((byte)1);
|
||||||
|
|
@ -2531,7 +2535,7 @@ namespace PascalABCCompiler.PCU
|
||||||
{
|
{
|
||||||
bw.Write((byte)0);
|
bw.Write((byte)0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Является ли тип описанием дженерика
|
//Является ли тип описанием дженерика
|
||||||
if (type.is_generic_type_definition)
|
if (type.is_generic_type_definition)
|
||||||
{
|
{
|
||||||
|
|
@ -2552,10 +2556,7 @@ namespace PascalABCCompiler.PCU
|
||||||
int base_class_off = (int)bw.BaseStream.Position;
|
int base_class_off = (int)bw.BaseStream.Position;
|
||||||
|
|
||||||
bw.Seek(GetSizeOfReference(type.base_type), SeekOrigin.Current);
|
bw.Seek(GetSizeOfReference(type.base_type), SeekOrigin.Current);
|
||||||
|
|
||||||
//(ssyy) На кой чёрт это надо?
|
|
||||||
//WriteTypeReference(SystemLibrary.SystemLibrary.object_type);
|
|
||||||
//WriteTypeReference(type.base_type);
|
|
||||||
bw.Write(type.internal_is_value);
|
bw.Write(type.internal_is_value);
|
||||||
|
|
||||||
//Пишем поддерживаемые интерфейсы
|
//Пишем поддерживаемые интерфейсы
|
||||||
|
|
@ -2563,8 +2564,8 @@ namespace PascalABCCompiler.PCU
|
||||||
//WriteImplementingInterfaces(type);
|
//WriteImplementingInterfaces(type);
|
||||||
int interface_impl_off = (int)bw.BaseStream.Position;
|
int interface_impl_off = (int)bw.BaseStream.Position;
|
||||||
int seek_off = sizeof(int);
|
int seek_off = sizeof(int);
|
||||||
for (int k=0; k<type.ImplementingInterfaces.Count; k++)
|
for (int k = 0; k < type.ImplementingInterfaces.Count; k++)
|
||||||
seek_off += GetSizeOfReference(type.ImplementingInterfaces[k] as TreeRealization.type_node);
|
seek_off += GetSizeOfReference(type.ImplementingInterfaces[k] as TreeRealization.type_node);
|
||||||
bw.Seek(seek_off, SeekOrigin.Current);
|
bw.Seek(seek_off, SeekOrigin.Current);
|
||||||
bw.Write((byte)type.type_access_level);
|
bw.Write((byte)type.type_access_level);
|
||||||
bw.Write((byte)type.type_special_kind);
|
bw.Write((byte)type.type_special_kind);
|
||||||
|
|
@ -2572,11 +2573,12 @@ namespace PascalABCCompiler.PCU
|
||||||
bw.Write(type.IsAbstract);
|
bw.Write(type.IsAbstract);
|
||||||
bw.Write(type.IsStatic);
|
bw.Write(type.IsStatic);
|
||||||
bw.Write(type.IsPartial);
|
bw.Write(type.IsPartial);
|
||||||
|
|
||||||
if (type.type_special_kind == SemanticTree.type_special_kind.diap_type)
|
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;
|
ordinal_type_interface oti = type.get_internal_interface(internal_interface_kind.ordinal_interface) as ordinal_type_interface;
|
||||||
VisitExpression(oti.lower_value);
|
VisitExpression(oti.lower_value);
|
||||||
VisitExpression(oti.upper_value);
|
VisitExpression(oti.upper_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type.is_generic_type_definition)
|
if (type.is_generic_type_definition)
|
||||||
|
|
@ -2584,52 +2586,52 @@ namespace PascalABCCompiler.PCU
|
||||||
//Ограничители параметров
|
//Ограничители параметров
|
||||||
WriteTypeParamsEliminations(type.generic_params);
|
WriteTypeParamsEliminations(type.generic_params);
|
||||||
}
|
}
|
||||||
if(CanWriteObject(type.element_type))
|
if (CanWriteObject(type.element_type))
|
||||||
WriteTypeReference(type.element_type);
|
WriteTypeReference(type.element_type);
|
||||||
|
|
||||||
bw.Write(GetUnitReference(type.comprehensive_namespace));
|
bw.Write(GetUnitReference(type.comprehensive_namespace));
|
||||||
SaveOffsetForAttribute(type);
|
SaveOffsetForAttribute(type);
|
||||||
bw.Write(0);//attributes;
|
bw.Write(0);//attributes;
|
||||||
if (type.default_property != null)
|
if (type.default_property != null)
|
||||||
bw.Write((byte)1);
|
bw.Write((byte)1);
|
||||||
else
|
else
|
||||||
bw.Write((byte)0);
|
bw.Write((byte)0);
|
||||||
int def_prop_off = (int)bw.BaseStream.Position;
|
int def_prop_off = (int)bw.BaseStream.Position;
|
||||||
if (type.default_property != null)
|
if (type.default_property != null)
|
||||||
bw.Write(0);//default_property
|
bw.Write(0);//default_property
|
||||||
WriteDebugInfo(type.loc);
|
WriteDebugInfo(type.loc);
|
||||||
//заполнение списка имен членов этого класса
|
//заполнение списка имен членов этого класса
|
||||||
int num = type.const_defs.Count + type.fields.Count + type.properties.Count + type.methods.Count+type.events.Count;
|
int num = type.const_defs.Count + type.fields.Count + type.properties.Count + type.methods.Count + type.events.Count;
|
||||||
NameRef[] names = new NameRef[num];
|
NameRef[] names = new NameRef[num];
|
||||||
int pos = (int)bw.BaseStream.Position;
|
int pos = (int)bw.BaseStream.Position;
|
||||||
int int_size = System.Runtime.InteropServices.Marshal.SizeOf(typeof(int));
|
int int_size = System.Runtime.InteropServices.Marshal.SizeOf(typeof(int));
|
||||||
int size = int_size;
|
int size = int_size;
|
||||||
int i=0,j=0;
|
int i = 0, j = 0;
|
||||||
for (i=j; i<type.const_defs.Count+j; i++)
|
for (i = j; i < type.const_defs.Count + j; i++)
|
||||||
{
|
{
|
||||||
names[i] = new NameRef(type.const_defs[i - j].name, i);
|
names[i] = new NameRef(type.const_defs[i - j].name, i);
|
||||||
name_pool[type.const_defs[i - j]] = names[i];
|
name_pool[type.const_defs[i - j]] = names[i];
|
||||||
size += names[i].Size;
|
size += names[i].Size;
|
||||||
}
|
}
|
||||||
j=i;
|
j = i;
|
||||||
for (i=j; i<type.fields.Count+j; i++)
|
for (i = j; i < type.fields.Count + j; i++)
|
||||||
{
|
{
|
||||||
names[i] = new NameRef(type.fields[i - j].name, i, convert_field_access_level(type.fields[i - j].field_access_level), type.fields[i - j].semantic_node_type);
|
names[i] = new NameRef(type.fields[i - j].name, i, convert_field_access_level(type.fields[i - j].field_access_level), type.fields[i - j].semantic_node_type);
|
||||||
name_pool[type.fields[i - j]] = names[i];
|
name_pool[type.fields[i - j]] = names[i];
|
||||||
names[i].is_static = type.fields[i - j].polymorphic_state == SemanticTree.polymorphic_state.ps_static;
|
names[i].is_static = type.fields[i - j].polymorphic_state == SemanticTree.polymorphic_state.ps_static;
|
||||||
size += names[i].Size;
|
size += names[i].Size;
|
||||||
}
|
}
|
||||||
j=i;
|
j = i;
|
||||||
for (i=j; i<type.properties.Count+j; i++)
|
for (i = j; i < type.properties.Count + j; i++)
|
||||||
{
|
{
|
||||||
names[i] = new NameRef(type.properties[i - j].name, i, convert_field_access_level(type.properties[i - j].field_access_level), type.properties[i - j].semantic_node_type);
|
names[i] = new NameRef(type.properties[i - j].name, i, convert_field_access_level(type.properties[i - j].field_access_level), type.properties[i - j].semantic_node_type);
|
||||||
name_pool[type.properties[i - j]] = names[i];
|
name_pool[type.properties[i - j]] = names[i];
|
||||||
names[i].is_static = type.properties[i - j].polymorphic_state == SemanticTree.polymorphic_state.ps_static;
|
names[i].is_static = type.properties[i - j].polymorphic_state == SemanticTree.polymorphic_state.ps_static;
|
||||||
size += names[i].Size;
|
size += names[i].Size;
|
||||||
}
|
}
|
||||||
j=i;
|
j = i;
|
||||||
for (i=j; i<type.methods.Count+j; i++)
|
for (i = j; i < type.methods.Count + j; i++)
|
||||||
{
|
{
|
||||||
names[i] = new NameRef(type.methods[i - j].name, i, convert_field_access_level(type.methods[i - j].field_access_level), type.methods[i - j].semantic_node_type);
|
names[i] = new NameRef(type.methods[i - j].name, i, convert_field_access_level(type.methods[i - j].field_access_level), type.methods[i - j].semantic_node_type);
|
||||||
name_pool[type.methods[i - j]] = names[i];
|
name_pool[type.methods[i - j]] = names[i];
|
||||||
if (type.methods[i - j].is_overload)
|
if (type.methods[i - j].is_overload)
|
||||||
|
|
@ -2637,16 +2639,16 @@ namespace PascalABCCompiler.PCU
|
||||||
names[i].virtual_slot = type.methods[i - j].newslot_awaited || type.methods[i - j].polymorphic_state == SemanticTree.polymorphic_state.ps_virtual || type.methods[i - j].polymorphic_state == SemanticTree.polymorphic_state.ps_virtual_abstract || type.methods[i - j].is_constructor;
|
names[i].virtual_slot = type.methods[i - j].newslot_awaited || type.methods[i - j].polymorphic_state == SemanticTree.polymorphic_state.ps_virtual || type.methods[i - j].polymorphic_state == SemanticTree.polymorphic_state.ps_virtual_abstract || type.methods[i - j].is_constructor;
|
||||||
names[i].is_static = type.methods[i - j].polymorphic_state == SemanticTree.polymorphic_state.ps_static && !type.methods[i - j].is_constructor;
|
names[i].is_static = type.methods[i - j].polymorphic_state == SemanticTree.polymorphic_state.ps_static && !type.methods[i - j].is_constructor;
|
||||||
size += names[i].Size;
|
size += names[i].Size;
|
||||||
}
|
}
|
||||||
j=i;
|
j = i;
|
||||||
for (i=j; i<type.events.Count+j; i++)
|
for (i = j; i < type.events.Count + j; i++)
|
||||||
{
|
{
|
||||||
names[i] = new NameRef(type.events[i - j].name, i, convert_field_access_level(type.events[i - j].field_access_level), type.events[i - j].semantic_node_type);
|
names[i] = new NameRef(type.events[i - j].name, i, convert_field_access_level(type.events[i - j].field_access_level), type.events[i - j].semantic_node_type);
|
||||||
name_pool[type.events[i - j]] = names[i];
|
name_pool[type.events[i - j]] = names[i];
|
||||||
size += names[i].Size;
|
size += names[i].Size;
|
||||||
}
|
}
|
||||||
bw.BaseStream.Seek(size,SeekOrigin.Current);
|
bw.BaseStream.Seek(size, SeekOrigin.Current);
|
||||||
/*VisitConstantInTypeDefinitions(type);
|
/*VisitConstantInTypeDefinitions(type);
|
||||||
VisitFieldDefinitions(type);
|
VisitFieldDefinitions(type);
|
||||||
VisitMethodDefinitions(type);
|
VisitMethodDefinitions(type);
|
||||||
VisitPropertyDefinitions(type);
|
VisitPropertyDefinitions(type);
|
||||||
|
|
@ -2665,9 +2667,9 @@ namespace PascalABCCompiler.PCU
|
||||||
bw.Write(names[i].offset);
|
bw.Write(names[i].offset);
|
||||||
}
|
}
|
||||||
bw.BaseStream.Seek(tmp,SeekOrigin.Begin);*/
|
bw.BaseStream.Seek(tmp,SeekOrigin.Begin);*/
|
||||||
ClassInfo ci = new ClassInfo(pos, def_prop_off, base_class_off, interface_impl_off,names);
|
ClassInfo ci = new ClassInfo(pos, def_prop_off, base_class_off, interface_impl_off, names);
|
||||||
class_info[type] = ci;
|
class_info[type] = ci;
|
||||||
}
|
}
|
||||||
|
|
||||||
//ssyy
|
//ssyy
|
||||||
private void VisitLabelDeclaration(label_node ln)
|
private void VisitLabelDeclaration(label_node ln)
|
||||||
|
|
|
||||||
|
|
@ -830,4 +830,13 @@ end;
|
||||||
|
|
||||||
{$endregion Utils}
|
{$endregion Utils}
|
||||||
|
|
||||||
|
///--
|
||||||
|
procedure __InitModule__;
|
||||||
|
begin
|
||||||
|
end;
|
||||||
|
|
||||||
|
///--
|
||||||
|
procedure __FinalizeModule__;
|
||||||
|
begin
|
||||||
|
end;
|
||||||
end.
|
end.
|
||||||
|
|
@ -2776,5 +2776,13 @@ end;
|
||||||
{$endregion}
|
{$endregion}
|
||||||
|
|
||||||
//----------------------------------------
|
//----------------------------------------
|
||||||
|
///--
|
||||||
|
procedure __InitModule__;
|
||||||
|
begin
|
||||||
|
end;
|
||||||
|
|
||||||
|
///--
|
||||||
|
procedure __FinalizeModule__;
|
||||||
|
begin
|
||||||
|
end;
|
||||||
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;
|
function H<T>(Self: array of T): integer; extensionmethod := Self.High;
|
||||||
|
|
||||||
|
|
||||||
|
///--
|
||||||
|
procedure __InitModule__;
|
||||||
|
begin
|
||||||
|
end;
|
||||||
|
|
||||||
|
///--
|
||||||
|
procedure __FinalizeModule__;
|
||||||
|
begin
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
@ -755,4 +755,13 @@ end;
|
||||||
|
|
||||||
{$endregion}
|
{$endregion}
|
||||||
|
|
||||||
|
///--
|
||||||
|
procedure __InitModule__;
|
||||||
|
begin
|
||||||
|
end;
|
||||||
|
|
||||||
|
///--
|
||||||
|
procedure __FinalizeModule__;
|
||||||
|
begin
|
||||||
|
end;
|
||||||
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