mirror of
https://github.com/github/codeql.git
synced 2026-04-26 01:05:15 +02:00
C#: Re-factor the check whether we are in standalone mode.
This commit is contained in:
@@ -31,7 +31,7 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
{
|
||||
if (assemblyPath is not null)
|
||||
{
|
||||
var isBuildlessOutputAssembly = isOutputAssembly && Context.ExtractionContext.Mode.HasFlag(ExtractorMode.Standalone);
|
||||
var isBuildlessOutputAssembly = isOutputAssembly && Context.ExtractionContext.IsStandalone;
|
||||
var identifier = isBuildlessOutputAssembly
|
||||
? ""
|
||||
: assembly.ToString() ?? "";
|
||||
@@ -72,7 +72,7 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
|
||||
public override void WriteId(EscapingTextWriter trapFile)
|
||||
{
|
||||
if (isOutputAssembly && Context.ExtractionContext.Mode.HasFlag(ExtractorMode.Standalone))
|
||||
if (isOutputAssembly && Context.ExtractionContext.IsStandalone)
|
||||
{
|
||||
trapFile.Write("buildlessOutputAssembly");
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
.Where(method => method.Parameters.Length >= Syntax.ArgumentList.Arguments.Count)
|
||||
.Where(method => method.Parameters.Count(p => !p.HasExplicitDefaultValue) <= Syntax.ArgumentList.Arguments.Count);
|
||||
|
||||
return Context.ExtractionContext.Mode.HasFlag(ExtractorMode.Standalone) ?
|
||||
return Context.ExtractionContext.IsStandalone ?
|
||||
candidates.FirstOrDefault() :
|
||||
candidates.SingleOrDefault();
|
||||
}
|
||||
|
||||
@@ -376,7 +376,7 @@ namespace Semmle.Extraction.CSharp
|
||||
|
||||
private void ReportError(InternalError error)
|
||||
{
|
||||
if (!ExtractionContext.Mode.HasFlag(ExtractorMode.Standalone))
|
||||
if (!ExtractionContext.IsStandalone)
|
||||
throw error;
|
||||
|
||||
ExtractionError(error);
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace Semmle.Extraction.CSharp
|
||||
public ExtractorMode Mode { get; }
|
||||
public string OutputPath { get; }
|
||||
public IEnumerable<CompilationInfo> CompilationInfos { get; }
|
||||
public bool IsStandalone => Mode.HasFlag(ExtractorMode.Standalone);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new extractor instance for one compilation unit.
|
||||
|
||||
Reference in New Issue
Block a user