C#: Fix extractor errors.

This commit is contained in:
calum
2019-02-21 16:13:25 +00:00
parent b7875aef20
commit d84fcbeedb
2 changed files with 2 additions and 3 deletions

View File

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

View File

@@ -36,7 +36,7 @@ namespace Semmle.Extraction.CSharp.Entities
var nts = (NullableTypeSyntax)Syntax;
var nt = (NamedType)Type;
Emit(Loc ?? Syntax.GetLocation(), Parent, Type);
Create(cx, nts.ElementType, this, nt.TypeArguments[0]);
Create(cx, nts.ElementType, this, nt.symbol.IsReferenceType ? nt : nt.TypeArguments[0]);
return;
case SyntaxKind.TupleType:
var tts = (TupleTypeSyntax)Syntax;