mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
C#: Only extract the unbound location for fields and parameters and use this location in the QL code.
This commit is contained in:
@@ -49,7 +49,10 @@ namespace Semmle.Extraction.CSharp.Entities
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteLocationsToTrap(trapFile.field_location, this, Locations);
|
if (Context.ExtractLocation(Symbol))
|
||||||
|
{
|
||||||
|
WriteLocationsToTrap(trapFile.field_location, this, Locations);
|
||||||
|
}
|
||||||
|
|
||||||
if (!IsSourceDeclaration || !Symbol.FromSource())
|
if (!IsSourceDeclaration || !Symbol.FromSource())
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -115,9 +115,10 @@ namespace Semmle.Extraction.CSharp.Entities
|
|||||||
var type = Type.Create(Context, Symbol.Type);
|
var type = Type.Create(Context, Symbol.Type);
|
||||||
trapFile.@params(this, Name, type.TypeRef, Ordinal, ParamKind, Parent!, Original);
|
trapFile.@params(this, Name, type.TypeRef, Ordinal, ParamKind, Parent!, Original);
|
||||||
|
|
||||||
foreach (var l in Symbol.Locations)
|
if (Context.ExtractLocation(Symbol))
|
||||||
{
|
{
|
||||||
WriteLocationToTrap(trapFile.param_location, this, Context.CreateLocation(l));
|
var locations = Context.GetLocations(Symbol);
|
||||||
|
WriteLocationsToTrap(trapFile.param_location, this, locations);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Symbol.Locations.Any() &&
|
if (!Symbol.Locations.Any() &&
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ class Parameter extends LocalScopeVariable, Attributable, TopLevelExprParent, @p
|
|||||||
params(this, _, getTypeRef(result), _, _, _, _)
|
params(this, _, getTypeRef(result), _, _, _, _)
|
||||||
}
|
}
|
||||||
|
|
||||||
override Location getALocation() { param_location(this, result) }
|
override Location getALocation() { param_location(this.getUnboundDeclaration(), result) }
|
||||||
|
|
||||||
override string toString() { result = this.getName() }
|
override string toString() { result = this.getName() }
|
||||||
|
|
||||||
@@ -449,7 +449,7 @@ class Field extends Variable, AssignableMember, Attributable, TopLevelExprParent
|
|||||||
fields(this, _, _, _, getTypeRef(result), _)
|
fields(this, _, _, _, getTypeRef(result), _)
|
||||||
}
|
}
|
||||||
|
|
||||||
override Location getALocation() { field_location(this, result) }
|
override Location getALocation() { field_location(this.getUnboundDeclaration(), result) }
|
||||||
|
|
||||||
override string toString() { result = Variable.super.toString() }
|
override string toString() { result = Variable.super.toString() }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user