@@ -40,6 +40,14 @@ private class ExprNodeImpl extends ExprNode, NodeImpl {
4040 override DataFlowCallable getEnclosingCallable ( ) { result = TDataFlowFunc ( n .getScope ( ) ) }
4141}
4242
43+ private class PatternNodeImpl extends PatternNode , NodeImpl {
44+ override Location getLocationImpl ( ) { result = pattern .getLocation ( ) }
45+
46+ override string toStringImpl ( ) { result = pattern .toString ( ) }
47+
48+ override DataFlowCallable getEnclosingCallable ( ) { result = TDataFlowFunc ( n .getScope ( ) ) }
49+ }
50+
4351private class SsaDefinitionNodeImpl extends SsaDefinitionNode , NodeImpl {
4452 override Location getLocationImpl ( ) { result = def .getLocation ( ) }
4553
@@ -63,6 +71,7 @@ private module Cached {
6371 cached
6472 newtype TNode =
6573 TExprNode ( CfgNode n , Expr e ) { hasExprNode ( n , e ) } or
74+ TPatternNode ( CfgNode n , Pattern p ) { hasPatternNode ( n , p ) } or
6675 TSsaDefinitionNode ( Ssa:: Definition def ) or
6776 TInoutReturnNode ( ParamDecl param ) { modifiableParam ( param ) } or
6877 TSummaryNode ( FlowSummary:: SummarizedCallable c , FlowSummaryImpl:: Private:: SummaryNodeState state ) {
@@ -231,6 +240,11 @@ private predicate hasExprNode(CfgNode n, Expr e) {
231240 n .( PropertyObserverCfgNode ) .getAssignExpr ( ) = e
232241}
233242
243+ private predicate hasPatternNode ( PatternCfgNode n , Pattern p ) {
244+ n .getPattern ( ) = p and
245+ p = p .resolve ( ) // no need to turn hidden-AST patterns (`let`s, parens) into data flow nodes
246+ }
247+
234248import Cached
235249
236250/** Holds if `n` should be hidden from path explanations. */
0 commit comments