Skip to content

Commit c31b594

Browse files
committed
C#: Address review comments.
1 parent 0a0867a commit c31b594

1 file changed

Lines changed: 10 additions & 16 deletions

File tree

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

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -57,30 +57,24 @@ class DeclarationWithGetSetAccessors extends DeclarationWithAccessors, TopLevelE
5757
/** Gets the `set` accessor of this declaration, if any. */
5858
Setter getSetter() { result = this.getAnAccessor() }
5959

60-
/** Gets the target `get` accessor of this declaration, if any. */
61-
private Getter getFirstGetter() {
62-
if exists(this.getGetter())
63-
then result = this.getGetter()
64-
else result = this.getOverridee().getFirstGetter()
65-
}
66-
6760
/** Gets the target accessor of this declaration when used in a read context, if any. */
68-
Accessor getReadTarget() { result = this.getFirstGetter() }
69-
70-
/** Gets the target `set` accessor of this declaration, if any. */
71-
private Setter getFirstSetter() {
72-
if exists(this.getSetter())
73-
then result = this.getSetter()
74-
else result = this.getOverridee().getFirstSetter()
61+
Accessor getReadTarget() {
62+
result = this.getGetter()
63+
or
64+
not exists(this.getGetter()) and
65+
result = this.getOverridee().getReadTarget()
7566
}
7667

7768
/** Gets the target accessor of this declaration when used in a write context, if any. */
7869
Accessor getWriteTarget() {
79-
result = this.getFirstSetter()
70+
result = this.getSetter()
71+
or
72+
not exists(this.getSetter()) and
73+
result = this.getOverridee().getWriteTarget()
8074
or
8175
result =
8276
any(Getter g |
83-
g = this.getFirstGetter() and
77+
g = this.getReadTarget() and
8478
g.getAnnotatedReturnType().isRef()
8579
)
8680
}

0 commit comments

Comments
 (0)