commit
31975754da
|
|
@ -1335,7 +1335,7 @@ namespace PascalABCCompiler.PCU
|
|||
loc = ReadDebugInfo();
|
||||
type_node elem_type = GetTypeReference();
|
||||
int rank = br.ReadInt32();
|
||||
return type_constructor.instance.create_unsized_array(elem_type, null, rank, loc);
|
||||
return type_constructor.instance.create_unsized_array(elem_type, rank, loc);
|
||||
case 6:
|
||||
return GetTemplateInstance();
|
||||
case 7:
|
||||
|
|
|
|||
6
TestSuite/units/u_common_arr1_0.pas
Normal file
6
TestSuite/units/u_common_arr1_0.pas
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
unit u_common_arr1_0;
|
||||
|
||||
uses u_common_arr1_1;
|
||||
uses u_common_arr1_2;
|
||||
|
||||
end.
|
||||
7
TestSuite/units/u_common_arr1_1.pas
Normal file
7
TestSuite/units/u_common_arr1_1.pas
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
unit u_common_arr1_1;
|
||||
|
||||
uses u_common_arr1_3;
|
||||
|
||||
var v1: array of c3;
|
||||
|
||||
end.
|
||||
7
TestSuite/units/u_common_arr1_2.pas
Normal file
7
TestSuite/units/u_common_arr1_2.pas
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
unit u_common_arr1_2;
|
||||
|
||||
uses u_common_arr1_3;
|
||||
|
||||
var v2: array of c3;
|
||||
|
||||
end.
|
||||
6
TestSuite/units/u_common_arr1_3.pas
Normal file
6
TestSuite/units/u_common_arr1_3.pas
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
unit u_common_arr1_3;
|
||||
|
||||
type
|
||||
c3 = class end;
|
||||
|
||||
end.
|
||||
5
TestSuite/usesunits/use_common_arr1.pas
Normal file
5
TestSuite/usesunits/use_common_arr1.pas
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
## uses u_common_arr1_1, u_common_arr1_2;
|
||||
|
||||
// Проверяем что типы всё ещё совместимые
|
||||
v1 := v2;
|
||||
v2 := v1;
|
||||
|
|
@ -14951,8 +14951,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
//AddError(new VoidNotValid(get_location(_array_type.elemets_types)));
|
||||
check_for_type_allowed(et,get_location(_array_type.elements_type));
|
||||
check_using_static_class(et, get_location(_array_type.elements_type));
|
||||
ret = convertion_data_and_alghoritms.type_constructor.create_unsized_array(et,
|
||||
context.converted_namespace, rank, get_location(_array_type));
|
||||
ret = convertion_data_and_alghoritms.type_constructor.create_unsized_array(et, rank, get_location(_array_type));
|
||||
return_value(ret);
|
||||
return;
|
||||
}
|
||||
|
|
@ -17237,7 +17236,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
if (tn is undefined_type || tn is null_type_node)
|
||||
{
|
||||
if (tn is ArrayConstType)
|
||||
return convertion_data_and_alghoritms.type_constructor.create_unsized_array((tn as ArrayConstType).element_type, context.converted_namespace, 1, loc);
|
||||
return convertion_data_and_alghoritms.type_constructor.create_unsized_array(((ArrayConstType)tn).element_type, 1, loc);
|
||||
AddError(loc, "CAN_NOT_DEDUCE_TYPE_{0}", tn.name);
|
||||
}
|
||||
return tn;
|
||||
|
|
@ -19645,7 +19644,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
//if (exprs.Count == 1)
|
||||
{
|
||||
//new typename[size]
|
||||
type_node atn = convertion_data_and_alghoritms.type_constructor.create_unsized_array(tn, context.converted_namespace, exprs.Count, loc);
|
||||
type_node atn = convertion_data_and_alghoritms.type_constructor.create_unsized_array(tn, exprs.Count, loc);
|
||||
//тип элементов
|
||||
typeof_operator to = new typeof_operator(tn, loc);
|
||||
List<expression_node> lst = new List<expression_node>();
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
private System.Collections.Generic.Dictionary<type_node, List<type_node>> types_unsized_arrays =
|
||||
new System.Collections.Generic.Dictionary<type_node, List<type_node>>();
|
||||
|
||||
public type_node create_unsized_array(type_node element_type, common_namespace_node cmn, int rank, location loc)
|
||||
public type_node create_unsized_array(type_node element_type, int rank, location loc)
|
||||
{
|
||||
List<type_node> ret = null;
|
||||
if(types_unsized_arrays.TryGetValue(element_type,out ret))
|
||||
|
|
@ -79,15 +79,10 @@ namespace PascalABCCompiler.TreeConverter
|
|||
SystemLibrary.SystemLibrary.init_reference_type(ctn);
|
||||
return ctn;
|
||||
}
|
||||
SymbolTable.Scope top_scope = null;
|
||||
if (cmn != null)
|
||||
{
|
||||
top_scope = cmn.scope;
|
||||
}
|
||||
|
||||
common_type_node comtn = new common_type_node(SystemLibrary.SystemLibrary.array_base_type,
|
||||
StringConstants.get_array_type_name(element_type.name,rank), SemanticTree.type_access_level.tal_public,
|
||||
cmn, convertion_data_and_alghoritms.symbol_table.CreateClassScope(top_scope,SystemLibrary.SystemLibrary.array_base_type.Scope), loc);
|
||||
null, convertion_data_and_alghoritms.symbol_table.CreateClassScope(null, SystemLibrary.SystemLibrary.array_base_type.Scope), loc);
|
||||
comtn.internal_type_special_kind = SemanticTree.type_special_kind.array_kind;
|
||||
comtn.is_class = true;
|
||||
comtn.add_internal_interface(aii);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Ivan Bondarev, Stanislav Mikhalkovich (for details please see \doc\copyright.txt)
|
||||
// Copyright (c) Ivan Bondarev, Stanislav Mikhalkovich (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//Здесь описана реализация generic-типов
|
||||
//Файлом владеет ssyy.
|
||||
|
|
@ -508,7 +508,7 @@ namespace PascalABCCompiler.TreeRealization
|
|||
type_node elem_tp = determine_type(ii.element_type, param_types, method_param_types, generic_param_types);
|
||||
if (elem_tp != ii.element_type)
|
||||
{
|
||||
return SystemLibrary.SystemLibrary.syn_visitor.convertion_data_and_alghoritms.type_constructor.create_unsized_array(elem_tp, null, ii.rank, null);
|
||||
return SystemLibrary.SystemLibrary.syn_visitor.convertion_data_and_alghoritms.type_constructor.create_unsized_array(elem_tp, ii.rank, null);
|
||||
}
|
||||
return tn;
|
||||
}
|
||||
|
|
@ -555,7 +555,7 @@ namespace PascalABCCompiler.TreeRealization
|
|||
type_node elem_tp = determine_type(comm_type.element_type, param_types, method_param_types, generic_param_types);
|
||||
if (elem_tp != comm_type.element_type)
|
||||
{
|
||||
return SystemLibrary.SystemLibrary.syn_visitor.convertion_data_and_alghoritms.type_constructor.create_unsized_array(elem_tp, null, 1, comm_type.loc);
|
||||
return SystemLibrary.SystemLibrary.syn_visitor.convertion_data_and_alghoritms.type_constructor.create_unsized_array(elem_tp, 1, comm_type.loc);
|
||||
}
|
||||
return tn;
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -188,6 +188,8 @@ end;
|
|||
procedure CompileAllUnits;
|
||||
begin
|
||||
var comp := new Compiler();
|
||||
// Не пропускать ошибки сохранения PCU, в тесте создания PCU
|
||||
comp.InternalDebug.SkipPCUErrors := false;
|
||||
var files := Directory.GetFiles(TestSuiteDir + PathSeparator + 'units', '*.pas');
|
||||
var dir := TestSuiteDir + PathSeparator + 'units' + PathSeparator;
|
||||
for var i := 0 to files.Length - 1 do
|
||||
|
|
|
|||
Loading…
Reference in a new issue