Treat class names in array/find/hash patterns as sub-patterns

This commit is contained in:
Arthur Baars
2021-12-01 21:01:34 +01:00
parent d17c055139
commit 513fe09dbb
3 changed files with 1 additions and 17 deletions

View File

@@ -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

View File

@@ -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()

View File

@@ -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()
}