Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
86595de
new TypeName methods
adamsitnik Jun 18, 2024
d906606
do not join the type and library name strings when UndoTruncatedTypeN…
adamsitnik Jun 19, 2024
448f01e
cache known primitive type names (and SZArrays of these)
adamsitnik Jun 19, 2024
b37b8da
add more tests and finish WithAssemblyName implementation
adamsitnik Jun 19, 2024
6b933d9
finish the implementation
adamsitnik Jun 28, 2024
f707dfd
Merge remote-tracking branch 'upstream/main' into extendTypeName
adamsitnik Jun 28, 2024
1736b24
add missing IntPtr and UIntPtr support (discovered once I've re-enabl…
adamsitnik Jun 28, 2024
a54e55f
use TypeNameMatches in more places
adamsitnik Jun 28, 2024
7d2d0d6
Merge remote-tracking branch 'upstream/main' into extendTypeName
adamsitnik Aug 2, 2024
9a0cd58
address API review feedback
adamsitnik Aug 2, 2024
aabe51b
remove CreateSimpleTypeName, introduce MakeSimpleTypeNameThrowsForNon…
adamsitnik Aug 2, 2024
e207e0f
handle nested names properly
adamsitnik Aug 6, 2024
19f1e82
update the code after reading it again on GH
adamsitnik Aug 6, 2024
6d03c00
Merge remote-tracking branch 'upstream/main' into extendTypeName
adamsitnik Aug 12, 2024
3abda02
address code review feedback
adamsitnik Aug 12, 2024
50a58fb
address code review feedback
adamsitnik Aug 12, 2024
ebfc35e
address code review feedback
adamsitnik Aug 13, 2024
f50ae19
rename MakeSimpleTypeName to WithAssemblyName
adamsitnik Aug 13, 2024
69cd1fa
Apply suggestions from code review
adamsitnik Aug 14, 2024
aa0870f
don't use sbyte to store array rank, the limit of 32 can be changed i…
adamsitnik Aug 14, 2024
30be71e
fix the build
adamsitnik Aug 14, 2024
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
Prev Previous commit
Next Next commit
use TypeNameMatches in more places
  • Loading branch information
adamsitnik committed Jun 28, 2024
commit a54e55fceabdcd0b603e3a471f8741a4b0c4296d
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,30 @@ internal override (AllowedRecordTypes allowed, PrimitiveType primitiveType) GetN
// to get a single primitive value!
internal SerializationRecord TryToMapToUserFriendly()
{
if (!TypeName.IsSimple)
{
return this;
}

if (MemberValues.Count == 1)
{
if (HasMember("m_value"))
{
return MemberValues[0] switch
{
// there can be a value match, but no TypeName match
bool value when TypeName.FullName == typeof(bool).FullName => Create(value),
byte value when TypeName.FullName == typeof(byte).FullName => Create(value),
sbyte value when TypeName.FullName == typeof(sbyte).FullName => Create(value),
char value when TypeName.FullName == typeof(char).FullName => Create(value),
short value when TypeName.FullName == typeof(short).FullName => Create(value),
ushort value when TypeName.FullName == typeof(ushort).FullName => Create(value),
int value when TypeName.FullName == typeof(int).FullName => Create(value),
uint value when TypeName.FullName == typeof(uint).FullName => Create(value),
long value when TypeName.FullName == typeof(long).FullName => Create(value),
ulong value when TypeName.FullName == typeof(ulong).FullName => Create(value),
float value when TypeName.FullName == typeof(float).FullName => Create(value),
double value when TypeName.FullName == typeof(double).FullName => Create(value),
bool value when TypeNameMatches(typeof(bool)) => Create(value),
byte value when TypeNameMatches(typeof(byte)) => Create(value),
sbyte value when TypeNameMatches(typeof(sbyte)) => Create(value),
char value when TypeNameMatches(typeof(char)) => Create(value),
short value when TypeNameMatches(typeof(short)) => Create(value),
ushort value when TypeNameMatches(typeof(ushort)) => Create(value),
int value when TypeNameMatches(typeof(int)) => Create(value),
uint value when TypeNameMatches(typeof(uint)) => Create(value),
long value when TypeNameMatches(typeof(long)) => Create(value),
ulong value when TypeNameMatches(typeof(ulong)) => Create(value),
float value when TypeNameMatches(typeof(float)) => Create(value),
double value when TypeNameMatches(typeof(double)) => Create(value),
_ => this
};
}
Expand All @@ -65,12 +70,12 @@ internal SerializationRecord TryToMapToUserFriendly()
return MemberValues[0] switch
{
// there can be a value match, but no TypeName match
long value when TypeName.FullName == typeof(IntPtr).FullName => Create(new IntPtr(value)),
ulong value when TypeName.FullName == typeof(UIntPtr).FullName => Create(new UIntPtr(value)),
long value when TypeNameMatches(typeof(IntPtr)) => Create(new IntPtr(value)),
ulong value when TypeNameMatches(typeof(UIntPtr)) => Create(new UIntPtr(value)),
_ => this
};
}
else if (HasMember("_ticks") && MemberValues[0] is long ticks && TypeName.FullName == typeof(TimeSpan).FullName)
else if (HasMember("_ticks") && MemberValues[0] is long ticks && TypeNameMatches(typeof(TimeSpan)))
{
return Create(new TimeSpan(ticks));
}
Expand Down