C#: Fix error caused by Roslyn upgrade.

This commit is contained in:
Calum Grant
2019-05-22 16:14:40 +01:00
parent e5aa7f3ba7
commit fcfb7b2b8a

View File

@@ -139,16 +139,9 @@ namespace Semmle.Extraction.CSharp.Entities
if (nt.TypeKind == TypeKind.Struct) if (nt.TypeKind == TypeKind.Struct)
{ {
// Sadly, these properties are internal so cannot be accessed directly. if (nt.IsReadOnly)
// This seems to be a deficiency in the model.
var readonlyProperty = nt.GetType().GetProperty("IsReadOnly", BindingFlags.NonPublic | BindingFlags.Instance);
bool isReadOnly = (bool)readonlyProperty.GetValue(nt);
bool isByRefLikeType = nt.IsRefLikeType;
if (isReadOnly)
HasModifier(cx, key, "readonly"); HasModifier(cx, key, "readonly");
if (isByRefLikeType) if (nt.IsRefLikeType)
HasModifier(cx, key, "ref"); HasModifier(cx, key, "ref");
} }
} }