fix #3155
This commit is contained in:
parent
fb7c3988e6
commit
7931ec4ff9
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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,13 @@ namespace PascalABCCompiler.TreeConverter
|
|||
SystemLibrary.SystemLibrary.init_reference_type(ctn);
|
||||
return ctn;
|
||||
}
|
||||
SymbolTable.Scope top_scope = null;
|
||||
if (cmn != null)
|
||||
{
|
||||
top_scope = cmn.scope;
|
||||
}
|
||||
// Not compiled type - then common type
|
||||
var comm_element_type = (common_type_node)element_type;
|
||||
var cmn = comm_element_type.comprehensive_namespace;
|
||||
|
||||
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);
|
||||
cmn, convertion_data_and_alghoritms.symbol_table.CreateClassScope(cmn?.scope, 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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue