Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -270,14 +270,9 @@ public bool Equals(TypeNameUtf8 other)
{
if (Utf8TypeNameLen != other.Utf8TypeNameLen)
return false;
byte* thisChars = (byte*)Utf8TypeName;
byte* otherChars = (byte*)other.Utf8TypeName;
for (int i = 0; i < Utf8TypeNameLen; i++)
{
if (thisChars[i] != otherChars[i])
return false;
}
return true;
ReadOnlySpan<byte> thisSpan = new ReadOnlySpan<byte>(Utf8TypeName, Utf8TypeNameLen);
ReadOnlySpan<byte> otherSpan = new ReadOnlySpan<byte>(other.Utf8TypeName, other.Utf8TypeNameLen);
return thisSpan.SequenceEqual(otherSpan);
}
}

Expand Down Expand Up @@ -346,12 +341,14 @@ public void Add(string key, TypeNameUtf8 targetType, RuntimeAssembly fallbackAss
int hash = ComputeHashCode(key);
// Allow duplicates that have the same string -> mapping. They may have different trimTargets.
// Warn if the mapping conflicts with an existing mapping.
if (_lazyData.TryGetValue(hash, out DelayedType? existing) && existing.TypeName.Equals(targetType))
if (!_lazyData.TryGetValue(hash, out DelayedType? existing))
{
_lazyData.Add(hash, new DelayedType(targetType, fallbackAssembly));
}
else if (!existing.TypeName.Equals(targetType))
{
ThrowHelper.ThrowAddingDuplicateWithKeyArgumentException(key);
}

_lazyData.Add(hash, new DelayedType(targetType, fallbackAssembly));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,10 @@ static Type GetTypeWithoutTrimAnalysis(string typeName)
class UsedTypeMap;
class TargetAndTrimTarget;
class TargetType;
class TargetType1;
class TargetType2;
class TrimTarget;
class TrimTarget1;
class TrimTarget2;
class TrimTarget3;
class UnreferencedTargetType;
class UnreferencedTrimTarget;
class SourceClass;
Expand Down
Loading