Skip to content

Commit 8ad05b7

Browse files
authored
add support for boolean literals
1 parent 4140ce0 commit 8ad05b7

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

ql/src/codeql_ql/ast/Ast.qll

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -990,6 +990,21 @@ class Float extends Literal {
990990
float getValue() { result = lit.getChild().(Generated::Float).getValue().toFloat() }
991991
}
992992

993+
/** A boolean literal */
994+
class Boolean extends Literal {
995+
Generated::Bool bool;
996+
997+
Boolean() { lit.getChild() = bool }
998+
999+
/** Holds if the value is `true` */
1000+
predicate isTrue() { bool.getChild() instanceof Generated::True }
1001+
1002+
/** Holds if the value is `false` */
1003+
predicate isFalse() { bool.getChild() instanceof Generated::False }
1004+
1005+
override string getAPrimaryQlClass() { result = "Boolean" }
1006+
}
1007+
9931008
/** A comparison symbol, such as `"<"` or `"="`. */
9941009
class ComparisonSymbol extends string {
9951010
ComparisonSymbol() {

0 commit comments

Comments
 (0)