Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
kekyo committed Apr 30, 2024
1 parent 65d2d14 commit f7b9ee0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
8 changes: 8 additions & 0 deletions chibild/chibild.core/Generating/CodeGenerator_LookupMember.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
36 changes: 14 additions & 22 deletions chibild/chibild.core/Internal/Utilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,32 +59,24 @@ public static string GetDirectoryPath(string path) =>
Path.GetFullPath(string.IsNullOrWhiteSpace(d) ? "." : d) :
Path.DirectorySeparatorChar.ToString();

public static string IntersectStrings(IEnumerable<string> strings)

#if NETFRAMEWORK || NETSTANDARD2_0
public static bool TryAdd<TKey, TValue>(
this Dictionary<TKey, TValue> 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<TR> Collect<TR, T>(
this IEnumerable<T> enumerable,
Expand Down

0 comments on commit f7b9ee0

Please sign in to comment.