Skip to content

Commit d7a2c7d

Browse files
committed
C#: Adjust the QL library to use the locations of the unbound declarations.
1 parent b2cbac3 commit d7a2c7d

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

csharp/ql/lib/semmle/code/csharp/Callable.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ class Method extends Callable, Virtualizable, Attributable, @method {
265265
result = Virtualizable.super.getAnUltimateImplementor()
266266
}
267267

268-
override Location getALocation() { method_location(this, result) }
268+
override Location getALocation() { method_location(this.getUnboundDeclaration(), result) }
269269

270270
/** Holds if this method is an extension method. */
271271
predicate isExtensionMethod() { this.getParameter(0).hasExtensionMethodModifier() }

csharp/ql/lib/semmle/code/csharp/Event.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class Event extends DeclarationWithAccessors, @event {
6868
result = DeclarationWithAccessors.super.getAnUltimateImplementor()
6969
}
7070

71-
override Location getALocation() { event_location(this, result) }
71+
override Location getALocation() { event_location(this.getUnboundDeclaration(), result) }
7272

7373
override string getAPrimaryQlClass() { result = "Event" }
7474
}
@@ -99,7 +99,7 @@ class EventAccessor extends Accessor, @event_accessor {
9999

100100
override Event getDeclaration() { event_accessors(this, _, _, result, _) }
101101

102-
override Location getALocation() { event_accessor_location(this, result) }
102+
override Location getALocation() { event_accessor_location(this.getUnboundDeclaration(), result) }
103103
}
104104

105105
/**

csharp/ql/lib/semmle/code/csharp/Property.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ class Property extends DeclarationWithGetSetAccessors, @property {
196196

197197
override PropertyAccess getAnAccess() { result.getTarget() = this }
198198

199-
override Location getALocation() { property_location(this, result) }
199+
override Location getALocation() { property_location(this.getUnboundDeclaration(), result) }
200200

201201
override Expr getAnAssignedValue() {
202202
result = DeclarationWithGetSetAccessors.super.getAnAssignedValue()
@@ -328,7 +328,7 @@ class Indexer extends DeclarationWithGetSetAccessors, Parameterizable, @indexer
328328
result = DeclarationWithGetSetAccessors.super.getAnUltimateImplementor()
329329
}
330330

331-
override Location getALocation() { indexer_location(this, result) }
331+
override Location getALocation() { indexer_location(this.getUnboundDeclaration(), result) }
332332

333333
override string toStringWithTypes() {
334334
result = this.getName() + "[" + this.parameterTypesToString() + "]"
@@ -408,7 +408,7 @@ class Accessor extends Callable, Modifiable, Attributable, Overridable, @callabl
408408

409409
override Accessor getUnboundDeclaration() { accessors(this, _, _, _, result) }
410410

411-
override Location getALocation() { accessor_location(this, result) }
411+
override Location getALocation() { accessor_location(this.getUnboundDeclaration(), result) }
412412

413413
override string toString() { result = this.getName() }
414414
}

0 commit comments

Comments
 (0)