diff --git a/chibild/chibild.core/Generating/CodeGenerator_LookupMember.cs b/chibild/chibild.core/Generating/CodeGenerator_LookupMember.cs index 02e047d..661ab40 100644 --- a/chibild/chibild.core/Generating/CodeGenerator_LookupMember.cs +++ b/chibild/chibild.core/Generating/CodeGenerator_LookupMember.cs @@ -179,6 +179,14 @@ private void DelayLookingUpType( { this.DelayLookingUpAction1(targetModule => { + var etr = TypeGenerator.ConstructCilType( + flat.ElementType, + resolvedTypeReferences); + + resolvedTypeReferences.TryAdd( + flat.ElementType.CilTypeName, + targetModule.SafeImport(etr)); + // At this point, the `resolvedTypeReferences` should contain // all the `TypeReferences` needed to construct a fixed length array type. if (TypeGenerator.TryGetFixedLengthArrayType( diff --git a/chibild/chibild.core/Internal/Utilities.cs b/chibild/chibild.core/Internal/Utilities.cs index f5576b0..70afb5b 100644 --- a/chibild/chibild.core/Internal/Utilities.cs +++ b/chibild/chibild.core/Internal/Utilities.cs @@ -59,32 +59,24 @@ public static string GetDirectoryPath(string path) => Path.GetFullPath(string.IsNullOrWhiteSpace(d) ? "." : d) : Path.DirectorySeparatorChar.ToString(); - public static string IntersectStrings(IEnumerable strings) + +#if NETFRAMEWORK || NETSTANDARD2_0 + public static bool TryAdd( + this Dictionary dict, + TKey key, + TValue value) { - var sb = new StringBuilder(); - foreach (var str in strings) + if (!dict.ContainsKey(key)) { - if (sb.Length == 0) - { - sb.Append(str); - } - else - { - var length = Math.Min(sb.Length, str.Length); - var index = 0; - while (index < length) - { - if (str[index] != sb[index]) - { - sb.Remove(index, sb.Length - index); - break; - } - index++; - } - } + dict.Add(key, value); + return true; + } + else + { + return false; } - return sb.ToString(); } +#endif public static IEnumerable Collect( this IEnumerable enumerable,