mirror of
https://github.com/github/codeql.git
synced 2026-04-29 10:45:15 +02:00
Treat class names in array/find/hash patterns as sub-patterns
This commit is contained in:
@@ -246,8 +246,6 @@ private module Cached {
|
||||
explicitAssignmentNode(g, _)
|
||||
or
|
||||
casePattern(g)
|
||||
or
|
||||
classReferencePattern(g)
|
||||
)
|
||||
} or
|
||||
TScopeResolutionMethodCall(Ruby::ScopeResolution g, Ruby::Identifier i) {
|
||||
@@ -293,8 +291,6 @@ private module Cached {
|
||||
explicitAssignmentNode(g, _)
|
||||
or
|
||||
casePattern(g)
|
||||
or
|
||||
classReferencePattern(g)
|
||||
} or
|
||||
TTokenMethodName(MethodName::Token g) { MethodName::range(g) } or
|
||||
TTokenSuperCall(Ruby::Super g) { vcall(g) } or
|
||||
|
||||
@@ -48,13 +48,7 @@ predicate casePattern(Ruby::AstNode node) {
|
||||
node = any(Ruby::KeywordPattern parent).getValue()
|
||||
or
|
||||
node = any(Ruby::ParenthesizedPattern parent).getChild()
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if `node` is a class reference used in an
|
||||
* array, find, or hash pattern.
|
||||
*/
|
||||
predicate classReferencePattern(Ruby::AstNode node) {
|
||||
or
|
||||
node = any(Ruby::ArrayPattern p).getClass()
|
||||
or
|
||||
node = any(Ruby::FindPattern p).getClass()
|
||||
|
||||
@@ -227,12 +227,6 @@ private predicate inMatchingContext(AstNode n) {
|
||||
or
|
||||
n instanceof CasePattern
|
||||
or
|
||||
n = any(ArrayPattern p).getClass()
|
||||
or
|
||||
n = any(FindPattern p).getClass()
|
||||
or
|
||||
n = any(HashPattern p).getClass()
|
||||
or
|
||||
n.(Trees::DefaultValueParameterTree).hasDefaultValue()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user