Skip to content

Commit a1ac9b1

Browse files
committed
Unified: Add more logical expressions to AstExtra.
1 parent 631419a commit a1ac9b1

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

‎unified/ql/lib/codeql/unified/internal/AstExtra.qll‎

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,26 @@
55
private import unified
66

77
module Public {
8-
/**
9-
* A logical 'and' expression with short-circuiting.
10-
*/
8+
/** A short-circuiting logical AND expression. */
119
class LogicalAndExpr extends BinaryExpr {
1210
LogicalAndExpr() { this.getOperator().getValue() = "&&" }
1311
}
1412

13+
/** A short-circuiting logical OR expression. */
14+
class LogicalOrExpr extends BinaryExpr {
15+
LogicalOrExpr() { this.getOperator().getValue() = "||" }
16+
}
17+
18+
/** A short-circuiting null-coalescing expression. */
19+
class NullCoalescingExpr extends BinaryExpr {
20+
NullCoalescingExpr() { this.getOperator().getValue() = "??" }
21+
}
22+
23+
/** A logical NOT expression. */
24+
class LogicalNotExpr extends UnaryExpr {
25+
LogicalNotExpr() { this.getOperator().(PrefixOperator).getValue() = "!" }
26+
}
27+
1528
/**
1629
* Declaration of a local or top-level variable.
1730
*/

0 commit comments

Comments
 (0)