mirror of
https://github.com/github/codeql.git
synced 2026-04-27 09:45:15 +02:00
C#: Address review comments
This commit is contained in:
@@ -171,15 +171,11 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
trapFile.Write('(');
|
||||
int index = 0;
|
||||
|
||||
if (method.MethodKind == MethodKind.ReducedExtension)
|
||||
{
|
||||
trapFile.WriteSeparator(",", ref index);
|
||||
method.ReceiverType.BuildOrWriteId(cx, trapFile, method);
|
||||
trapFile.Write(" ");
|
||||
trapFile.Write(method.ReducedFrom.Parameters.First().Name);
|
||||
}
|
||||
var @params = method.MethodKind == MethodKind.ReducedExtension
|
||||
? method.ReducedFrom.Parameters
|
||||
: method.Parameters;
|
||||
|
||||
foreach (var param in method.Parameters)
|
||||
foreach (var param in @params)
|
||||
{
|
||||
trapFile.WriteSeparator(",", ref index);
|
||||
param.Type.BuildOrWriteId(cx, trapFile, method);
|
||||
|
||||
@@ -288,7 +288,7 @@ namespace Semmle.Extraction.CSharp
|
||||
}
|
||||
else if (named.ContainingNamespace != null)
|
||||
{
|
||||
if (cx.AddAssemblyTrapPrefix && !(named.ContainingAssembly is null))
|
||||
if (cx.ShouldAddAssemblyTrapPrefix && named.ContainingAssembly is object)
|
||||
BuildAssembly(named.ContainingAssembly, trapFile);
|
||||
named.ContainingNamespace.BuildNamespace(cx, trapFile);
|
||||
}
|
||||
@@ -354,7 +354,7 @@ namespace Semmle.Extraction.CSharp
|
||||
// a base class, which in turn has `C1<C3<C4>>` as a base class. The latter has the original
|
||||
// base class `C3<C4>` as a type argument, which would lead to infinite unfolding.
|
||||
trapFile.Write(" : ");
|
||||
@base.BuildOrWriteId(cx, trapFile, symbolBeingDefined, false);
|
||||
@base.BuildOrWriteId(cx, trapFile, symbolBeingDefined, addBaseClass: false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Semmle.Extraction
|
||||
/// <summary>
|
||||
/// Holds if assembly information should be prefixed to TRAP labels.
|
||||
/// </summary>
|
||||
public readonly bool AddAssemblyTrapPrefix;
|
||||
public readonly bool ShouldAddAssemblyTrapPrefix;
|
||||
|
||||
int GetNewId() => TrapWriter.IdCounter++;
|
||||
|
||||
@@ -241,7 +241,7 @@ namespace Semmle.Extraction
|
||||
Compilation = c;
|
||||
Scope = scope;
|
||||
TrapWriter = trapWriter;
|
||||
AddAssemblyTrapPrefix = addAssemblyTrapPrefix;
|
||||
ShouldAddAssemblyTrapPrefix = addAssemblyTrapPrefix;
|
||||
}
|
||||
|
||||
public bool FromSource => Scope.FromSource;
|
||||
|
||||
Reference in New Issue
Block a user