Skip to content

Commit 779039b

Browse files
committed
C#: Address review comments
1 parent ceb9ccf commit 779039b

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

csharp/ql/src/semmle/code/csharp/Assignable.qll

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ module AssignableInternal {
161161
/**
162162
* A `ref` argument in a call.
163163
*
164-
* All predicates in this class deliberatly do not use the `Call` class, or any
164+
* All predicates in this class deliberately do not use the `Call` class, or any
165165
* subclass thereof, as that results in too conservative negative recursion
166166
* compilation errors.
167167
*/
@@ -205,11 +205,8 @@ module AssignableInternal {
205205
}
206206

207207
private Callable getSourceDeclarationTarget(Parameter p) {
208-
exists(Parameter parg |
209-
parg = this.getParameter() and
210-
p = parg.getSourceDeclaration() and
211-
result.getAParameter() = p
212-
)
208+
p = this.getParameter().getSourceDeclaration() and
209+
result.getAParameter() = p
213210
}
214211

215212
/**
@@ -244,8 +241,8 @@ module AssignableInternal {
244241
)
245242
}
246243

247-
/** Holds if this `ref` assignment is relevant. */
248-
predicate isRelevant() {
244+
/** Holds if this `ref` access is a potential assignment. */
245+
predicate isPotentialAssignment() {
249246
this.isNonAnalyzable() or
250247
exists(this.getAnAnalyzableRefDef(_))
251248
}
@@ -306,7 +303,7 @@ module AssignableInternal {
306303
TOutRefDefinition(AssignableAccess aa) {
307304
aa.isOutArgument()
308305
or
309-
aa.(RefArg).isRelevant()
306+
aa.(RefArg).isPotentialAssignment()
310307
} or
311308
TMutationDefinition(MutatorOperation mo) or
312309
TLocalVariableDefinition(LocalVariableDeclExpr lvde) {
@@ -347,7 +344,7 @@ module AssignableInternal {
347344
*/
348345
cached
349346
predicate isUncertainRefCall(RefArg arg) {
350-
arg.isRelevant() and
347+
arg.isPotentialAssignment() and
351348
exists(ControlFlow::BasicBlock bb, Parameter p | arg.isAnalyzable(p) |
352349
parameterReachesWithoutDef(p, bb) and
353350
bb.getLastNode() = p.getCallable().getExitPoint()

0 commit comments

Comments
 (0)