Skip to content

Commit bec5f29

Browse files
committed
Fixup of C# locations - use generic methods.
1 parent 01b789d commit bec5f29

File tree

1 file changed

+2
-10
lines changed
  • csharp/extractor/Semmle.Extraction.CSharp/Entities

1 file changed

+2
-10
lines changed

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

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -117,23 +117,15 @@ public override void Populate(TextWriter trapFile)
117117

118118
foreach (var l in Symbol.Locations)
119119
{
120-
var location = Context.CreateLocation(l);
121-
if (location is not EmptyLocation)
122-
{
123-
trapFile.param_location(this, location);
124-
}
120+
WriteLocationToTrap(trapFile.param_location, this, Context.CreateLocation(l));
125121
}
126122

127123
if (!Symbol.Locations.Any() &&
128124
Symbol.ContainingSymbol is IMethodSymbol ms &&
129125
ms.Name == WellKnownMemberNames.TopLevelStatementsEntryPointMethodName &&
130126
ms.ContainingType.Name == WellKnownMemberNames.TopLevelStatementsEntryPointTypeName)
131127
{
132-
var location = Context.CreateLocation();
133-
if (location is not EmptyLocation)
134-
{
135-
trapFile.param_location(this, location);
136-
}
128+
WriteLocationToTrap(trapFile.param_location, this, Context.CreateLocation());
137129
}
138130

139131
if (Symbol.HasExplicitDefaultValue && Context.Defines(Symbol))

0 commit comments

Comments
 (0)