Skip to content

Commit 57c6efc

Browse files
committed
C#: Add a NullCoalescingOperation class.
1 parent 1a944ec commit 57c6efc

File tree

1 file changed

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

1 file changed

+11
-0
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,17 @@ class BinaryOperation extends Operation, @bin_op {
252252
override string toString() { result = "... " + this.getOperator() + " ..." }
253253
}
254254

255+
/** A binary operation that involves a null-coalescing operation. */
256+
abstract private class NullCoalescingOperationImpl extends BinaryOperation { }
257+
258+
final class NullCoalescingOperation = NullCoalescingOperationImpl;
259+
260+
private class AddNullCoalescingExpr extends NullCoalescingOperationImpl instanceof NullCoalescingExpr
261+
{ }
262+
263+
private class AddAssignCoalesceExpr extends NullCoalescingOperationImpl instanceof AssignCoalesceExpr
264+
{ }
265+
255266
/**
256267
* A ternary operation, that is, a ternary conditional operation
257268
* (`ConditionalExpr`).

0 commit comments

Comments
 (0)