mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
Ruby: CFG: make VariableReferencePattern a PreOrder node
This commit is contained in:
@@ -227,6 +227,8 @@ private predicate inMatchingContext(AstNode n) {
|
||||
or
|
||||
n instanceof CasePattern
|
||||
or
|
||||
n = any(VariableReferencePattern p).getVariableAccess()
|
||||
or
|
||||
n = any(CasePattern c).getDesugared()
|
||||
or
|
||||
n.(Trees::DefaultValueParameterTree).hasDefaultValue()
|
||||
|
||||
@@ -722,7 +722,7 @@ module Trees {
|
||||
override ControlFlowTree getChildElement(int i) { result = this.getPattern() and i = 0 }
|
||||
}
|
||||
|
||||
private class VariableReferencePatternTree extends StandardPostOrderTree, VariableReferencePattern {
|
||||
private class VariableReferencePatternTree extends StandardPreOrderTree, VariableReferencePattern {
|
||||
override ControlFlowTree getChildElement(int i) { result = this.getVariableAccess() and i = 0 }
|
||||
}
|
||||
|
||||
|
||||
@@ -1046,14 +1046,14 @@ case.rb:
|
||||
#-----| match -> exit case_match_various (normal)
|
||||
|
||||
# 74| in ... then ...
|
||||
#-----| -> foo
|
||||
#-----| -> ^...
|
||||
|
||||
# 74| ^...
|
||||
#-----| no-match -> in ... then ...
|
||||
#-----| match -> exit case_match_various (normal)
|
||||
#-----| -> foo
|
||||
|
||||
# 74| foo
|
||||
#-----| -> ^...
|
||||
#-----| no-match -> in ... then ...
|
||||
#-----| match -> exit case_match_various (normal)
|
||||
|
||||
# 75| in ... then ...
|
||||
#-----| -> "string"
|
||||
@@ -1154,15 +1154,15 @@ case.rb:
|
||||
#-----| -> 5
|
||||
|
||||
# 83| 5
|
||||
#-----| no-match -> foo
|
||||
#-----| no-match -> ^...
|
||||
#-----| match -> exit case_match_various (normal)
|
||||
|
||||
# 83| ^...
|
||||
#-----| no-match -> "string"
|
||||
#-----| match -> exit case_match_various (normal)
|
||||
#-----| -> foo
|
||||
|
||||
# 83| foo
|
||||
#-----| -> ^...
|
||||
#-----| no-match -> "string"
|
||||
#-----| match -> exit case_match_various (normal)
|
||||
|
||||
# 83| "string"
|
||||
#-----| no-match -> in ... then ...
|
||||
|
||||
Reference in New Issue
Block a user