mirror of
https://github.com/github/codeql.git
synced 2026-05-04 13:15:21 +02:00
C#: Address review comments. Tidy up tuple generation, consolidating code and use run-time type information instead of FirstParam/NextParam.
This commit is contained in:
@@ -247,7 +247,7 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
}
|
||||
}
|
||||
|
||||
public bool TryGetPrimitiveTypeCode(out PrimitiveTypeCode code)
|
||||
private bool TryGetPrimitiveTypeCode(out PrimitiveTypeCode code)
|
||||
{
|
||||
if (ContainingType == null && Namespace.Name == cx.SystemNamespace.Name)
|
||||
{
|
||||
@@ -314,7 +314,7 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool IsPrimitiveType => TryGetPrimitiveTypeCode(out _);
|
||||
protected bool IsPrimitiveType => TryGetPrimitiveTypeCode(out _);
|
||||
|
||||
public static Type DecodeType(GenericContext gc, TypeSpecificationHandle handle) =>
|
||||
gc.cx.mdReader.GetTypeSpecification(handle).DecodeSignature(gc.cx.TypeSignatureDecoder, gc);
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Semmle.Extraction.CIL
|
||||
|
||||
public T Populate<T>(T e) where T : IExtractedEntity
|
||||
{
|
||||
if(e.Label.Valid)
|
||||
if (e.Label.Valid)
|
||||
{
|
||||
return e; // Already populated
|
||||
}
|
||||
@@ -72,7 +72,7 @@ namespace Semmle.Extraction.CIL
|
||||
{
|
||||
PrimitiveType e = primitiveTypes[(int)code];
|
||||
|
||||
if(e is null)
|
||||
if (e is null)
|
||||
{
|
||||
e = new PrimitiveType(this, code);
|
||||
e.Label = cx.GetNewLabel();
|
||||
@@ -157,7 +157,7 @@ namespace Semmle.Extraction.CIL
|
||||
/// <returns>The string.</returns>
|
||||
public string GetString(StringHandle h) => mdReader.GetString(h);
|
||||
|
||||
#region Namespaces
|
||||
#region Namespaces
|
||||
|
||||
readonly CachedFunction<StringHandle, Namespace> namespaceFactory;
|
||||
|
||||
@@ -197,9 +197,9 @@ namespace Semmle.Extraction.CIL
|
||||
NamespaceDefinition nd = mdReader.GetNamespaceDefinition(handle);
|
||||
return Populate(new Namespace(this, GetString(nd.Name), Create(nd.Parent)));
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Locations
|
||||
#region Locations
|
||||
readonly CachedFunction<PDB.ISourceFile, PdbSourceFile> sourceFiles;
|
||||
readonly CachedFunction<string, Folder> folders;
|
||||
readonly CachedFunction<PDB.Location, PdbSourceLocation> sourceLocations;
|
||||
@@ -225,7 +225,7 @@ namespace Semmle.Extraction.CIL
|
||||
/// <returns>A source location entity.</returns>
|
||||
public PdbSourceLocation CreateSourceLocation(PDB.Location loc) => sourceLocations[loc];
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
readonly CachedFunction<GenericContext, Handle, IExtractedEntity> genericHandleFactory;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user