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

Skip to content

Commit 7418c05

Browse files
committed
Always populate assemblies
1 parent 1c8547c commit 7418c05

6 files changed

Lines changed: 4 additions & 14 deletions

File tree

csharp/extractor/Semmle.Extraction.CSharp/Analyser.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ private void DoAnalyseCompilation(string cwd, string[] args)
232232
var projectLayout = layout.LookupProjectOrDefault(transformedAssemblyPath);
233233
var trapWriter = projectLayout.CreateTrapWriter(Logger, transformedAssemblyPath, options.TrapCompression, discardDuplicates: false);
234234
compilationTrapFile = trapWriter; // Dispose later
235-
var cx = extractor.CreateContext(compilation.Clone(), trapWriter, new AssemblyScope(assembly, assemblyPath, true), AddAssemblyTrapPrefix);
235+
var cx = extractor.CreateContext(compilation.Clone(), trapWriter, new AssemblyScope(assembly, assemblyPath), AddAssemblyTrapPrefix);
236236

237237
compilationEntity = new Entities.Compilation(cx, cwd, args);
238238
}
@@ -287,7 +287,7 @@ private void DoAnalyseReferenceAssembly(PortableExecutableReference r)
287287

288288
if (c.GetAssemblyOrModuleSymbol(r) is IAssemblySymbol assembly)
289289
{
290-
var cx = extractor.CreateContext(c, trapWriter, new AssemblyScope(assembly, assemblyPath, false), AddAssemblyTrapPrefix);
290+
var cx = extractor.CreateContext(c, trapWriter, new AssemblyScope(assembly, assemblyPath), AddAssemblyTrapPrefix);
291291

292292
foreach (var module in assembly.Modules)
293293
{

csharp/extractor/Semmle.Extraction/AssemblyScope.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,12 @@ public class AssemblyScope : IExtractionScope
1010
private readonly IAssemblySymbol assembly;
1111
private readonly string filepath;
1212

13-
public AssemblyScope(IAssemblySymbol symbol, string path, bool isOutput)
13+
public AssemblyScope(IAssemblySymbol symbol, string path)
1414
{
1515
assembly = symbol;
1616
filepath = path;
17-
IsGlobalScope = isOutput;
1817
}
1918

20-
public bool IsGlobalScope { get; }
21-
2219
public bool InFileScope(string path) => path == filepath;
2320

2421
public bool InScope(ISymbol symbol) =>

csharp/extractor/Semmle.Extraction/Context.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,6 @@ public Context(IExtractor e, Compilation c, TrapWriter trapWriter, IExtractionSc
244244

245245
public bool FromSource => scope.FromSource;
246246

247-
public bool IsGlobalContext => scope.IsGlobalScope;
248-
249247
public ICommentGenerator CommentGenerator { get; } = new CommentProcessor();
250248

251249
private IExtractionScope scope { get; }

csharp/extractor/Semmle.Extraction/Entities/Assembly.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ public override void Populate(TextWriter trapFile)
3535
}
3636
}
3737

38-
public override bool NeedsPopulation =>
39-
!SymbolEqualityComparer.Default.Equals(assembly, Context.Compilation.Assembly) || !Context.IsGlobalContext;
38+
public override bool NeedsPopulation => true;
4039

4140
public override int GetHashCode() =>
4241
symbol == null ? 91187354 : symbol.GetHashCode();

csharp/extractor/Semmle.Extraction/IExtractionScope.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ public interface IExtractionScope
2323
/// <param name="path">The path to populate.</param>
2424
bool InFileScope(string path);
2525

26-
bool IsGlobalScope { get; }
27-
2826
bool FromSource { get; }
2927
}
3028
}

csharp/extractor/Semmle.Extraction/SourceScope.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ public SourceScope(SyntaxTree tree)
1616
SourceTree = tree;
1717
}
1818

19-
public bool IsGlobalScope => false;
20-
2119
public bool InFileScope(string path) => path == SourceTree.FilePath;
2220

2321
public bool InScope(ISymbol symbol) => symbol.Locations.Any(loc => loc.SourceTree == SourceTree);

0 commit comments

Comments
 (0)