diff --git a/ql/src/codeql_ruby/controlflow/internal/AstNodes.qll b/ql/src/codeql_ruby/controlflow/internal/AstNodes.qll index 3692e3473f3..0f56af92ab6 100644 --- a/ql/src/codeql_ruby/controlflow/internal/AstNodes.qll +++ b/ql/src/codeql_ruby/controlflow/internal/AstNodes.qll @@ -40,7 +40,7 @@ class LogicalOrAstNode extends Binary { AstNode getAnOperand() { result in [left, right] } } -private class If_or_elisif = @if or @elsif; +private class If_or_elisif = @if or @elsif or @conditional; class IfElsifAstNode extends AstNode, If_or_elisif { AstNode getConditionNode() { none() } @@ -66,6 +66,14 @@ private class ElsifAstNode extends IfElsifAstNode, Elsif { override AstNode getAlternativeNode() { result = this.getAlternative() } } +private class ConditionalAstNode extends IfElsifAstNode, Conditional { + override AstNode getConditionNode() { result = this.getCondition() } + + override AstNode getConsequenceNode() { result = this.getConsequence() } + + override AstNode getAlternativeNode() { result = this.getAlternative() } +} + class ParenthesizedStatement extends ParenthesizedStatements { ParenthesizedStatement() { strictcount(int i | exists(this.getChild(i))) = 1 }