adding IReadOnlyList<T> interface to ones implemented by array (#3277)

This commit is contained in:
samuraiGH 2025-06-13 18:31:43 +03:00 committed by GitHub
parent 8d27ec3788
commit d49a41a025
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 18 additions and 0 deletions

View file

@ -60,6 +60,7 @@ namespace PascalABCCompiler.SystemLibrary
private static compiled_type_node _ilist1_interface;
private static compiled_type_node _icollection1_interface;
private static compiled_type_node _ireadonlycollection_interface;
private static compiled_type_node _ireadonlylist_interface;
private static compiled_type_node _ienumerable1_interface;
private static compiled_function_node _delegate_combine_method;
@ -1178,9 +1179,15 @@ namespace PascalABCCompiler.SystemLibrary
_icollection_interface = compiled_type_node.get_type_node(typeof(ICollection));
_ienumerable_interface = compiled_type_node.get_type_node(typeof(IEnumerable));
_ilist1_interface = compiled_type_node.get_type_node(typeof(IList<>));
var t = Type.GetType("System.Collections.Generic.IReadOnlyCollection`1");
if (t != null)
_ireadonlycollection_interface = compiled_type_node.get_type_node(t);
t = Type.GetType("System.Collections.Generic.IReadOnlyList`1");
if (t != null)
_ireadonlylist_interface = compiled_type_node.get_type_node(t);
_icollection1_interface = compiled_type_node.get_type_node(typeof(ICollection<>));
_ienumerable1_interface = compiled_type_node.get_type_node(typeof(IEnumerable<>));
_assert_method = compiled_function_node.get_compiled_method(typeof(System.Diagnostics.Debug).GetMethod("Assert",new Type[1]{typeof(bool)}));
@ -5272,6 +5279,14 @@ namespace PascalABCCompiler.SystemLibrary
}
}
public static compiled_type_node ireadonlylist_interface
{
get
{
return _ireadonlylist_interface;
}
}
public static compiled_function_node assert_method
{
get

View file

@ -125,6 +125,9 @@ namespace PascalABCCompiler.TreeConverter
comtn.ImplementingInterfaces.Add(SystemLibrary.SystemLibrary.ienumerable1_interface.get_instance(type_params));
if (SystemLibrary.SystemLibrary.ireadonlycollection_interface != null)
comtn.ImplementingInterfaces.Add(SystemLibrary.SystemLibrary.ireadonlycollection_interface.get_instance(type_params));
if (SystemLibrary.SystemLibrary.ireadonlylist_interface != null)
comtn.ImplementingInterfaces.Add(SystemLibrary.SystemLibrary.ireadonlylist_interface.get_instance(type_params));
}
//SystemLibrary.SystemLibrary.ic
//(ssyy) Убрал 18.05.08