From 84d277dc94fd41943d2edd6f9c13e0da4c615f9e Mon Sep 17 00:00:00 2001 From: Erik Krogh Kristensen Date: Thu, 18 Nov 2021 12:10:31 +0100 Subject: [PATCH] add getLeft/getRight helper predicates to disjunction/conjunction --- ql/src/codeql_ql/ast/Ast.qll | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/ql/src/codeql_ql/ast/Ast.qll b/ql/src/codeql_ql/ast/Ast.qll index e51a826f9a8..a6061b60730 100644 --- a/ql/src/codeql_ql/ast/Ast.qll +++ b/ql/src/codeql_ql/ast/Ast.qll @@ -1125,9 +1125,15 @@ class Conjunction extends TConjunction, AstNode, Formula { override string getAPrimaryQlClass() { result = "Conjunction" } - /** Gets an operand to this formula. */ + /** Gets an operand to this conjunction. */ Formula getAnOperand() { toQL(result) in [conj.getLeft(), conj.getRight()] } + /** Gets the left operand to this conjunction. */ + Formula getLeft() { toQL(result) = conj.getLeft() } + + /** Gets the right operand to this conjunction. */ + Formula getRight() { toQL(result) = conj.getRight() } + override AstNode getAChild(string pred) { result = super.getAChild(pred) or @@ -1143,9 +1149,15 @@ class Disjunction extends TDisjunction, AstNode, Formula { override string getAPrimaryQlClass() { result = "Disjunction" } - /** Gets an operand to this formula. */ + /** Gets an operand to this disjunction. */ Formula getAnOperand() { toQL(result) in [disj.getLeft(), disj.getRight()] } + /** Gets the left operand to this disjunction */ + Formula getLeft() { toQL(result) = disj.getLeft() } + + /** Gets the right operand to this disjunction */ + Formula getRight() { toQL(result) = disj.getRight() } + override AstNode getAChild(string pred) { result = super.getAChild(pred) or