mirror of
https://github.com/github/codeql.git
synced 2026-02-20 08:53:49 +01:00
Treat conditional expressions as if-then-else
This commit is contained in:
@@ -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 }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user