Skip to content

Commit e237344

Browse files
committed
C#: Take compound assignment operator argument shift into account for operators declared as extensions.
1 parent c739bb6 commit e237344

File tree

1 file changed

+10
-0
lines changed
  • csharp/ql/lib/semmle/code/csharp/exprs

1 file changed

+10
-0
lines changed

csharp/ql/lib/semmle/code/csharp/exprs/Call.qll

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,16 @@ class ExtensionOperatorCall extends OperatorCall {
525525
ExtensionOperatorCall() { this.getTarget() instanceof ExtensionOperator }
526526

527527
override string getAPrimaryQlClass() { result = "ExtensionOperatorCall" }
528+
529+
private predicate isOrdinaryStaticCall() {
530+
not exists(Expr e | e = this.getChildExpr(-1) | not e instanceof TypeAccess)
531+
}
532+
533+
override Expr getArgument(int i) {
534+
exists(int j | result = this.getChildExpr(j) |
535+
if this.isOrdinaryStaticCall() then (j = i and j >= 0) else (j = i - 1 and j >= -1)
536+
)
537+
}
528538
}
529539

530540
/**

0 commit comments

Comments
 (0)