Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d84fcbe

Browse files
committed
C#: Fix extractor errors.
1 parent b7875ae commit d84fcbe

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

csharp/extractor/Semmle.Extraction.CSharp/Entities/Modifier.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,9 @@ public static void ExtractModifiers(Context cx, IEntity key, ISymbol symbol)
142142
// Sadly, these properties are internal so cannot be accessed directly.
143143
// This seems to be a deficiency in the model.
144144
var readonlyProperty = nt.GetType().GetProperty("IsReadOnly", BindingFlags.NonPublic | BindingFlags.Instance);
145-
var isByRefProperty = nt.GetType().GetProperty("IsByRefLikeType", BindingFlags.NonPublic | BindingFlags.Instance);
146145

147146
bool isReadOnly = (bool)readonlyProperty.GetValue(nt);
148-
bool isByRefLikeType = (bool)isByRefProperty.GetValue(nt);
147+
bool isByRefLikeType = nt.IsRefLikeType;
149148

150149
if (isReadOnly)
151150
HasModifier(cx, key, "readonly");

csharp/extractor/Semmle.Extraction.CSharp/Entities/TypeMention.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ void Populate()
3636
var nts = (NullableTypeSyntax)Syntax;
3737
var nt = (NamedType)Type;
3838
Emit(Loc ?? Syntax.GetLocation(), Parent, Type);
39-
Create(cx, nts.ElementType, this, nt.TypeArguments[0]);
39+
Create(cx, nts.ElementType, this, nt.symbol.IsReferenceType ? nt : nt.TypeArguments[0]);
4040
return;
4141
case SyntaxKind.TupleType:
4242
var tts = (TupleTypeSyntax)Syntax;

0 commit comments

Comments
 (0)