From cb52ab669e6733c234244956b02b7e6dae0404ea Mon Sep 17 00:00:00 2001 From: Rasmus Lerchedahl Petersen Date: Thu, 27 Jan 2022 11:17:00 +0100 Subject: [PATCH] python: address review comments The comment about `py_scopes` was simply removed --- python/ql/lib/semmle/python/AstExtended.qll | 2 +- python/ql/lib/semmle/python/Patterns.qll | 7 +------ .../python/dataflow/new/internal/DataFlowPrivate.qll | 4 ++-- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/python/ql/lib/semmle/python/AstExtended.qll b/python/ql/lib/semmle/python/AstExtended.qll index 0a7fce5ebd6..58042cd8dbf 100644 --- a/python/ql/lib/semmle/python/AstExtended.qll +++ b/python/ql/lib/semmle/python/AstExtended.qll @@ -83,7 +83,7 @@ library class StrListParent extends StrListParent_ { } library class ExprParent extends ExprParent_ { } /** Internal implementation class */ -library class PatternListParent extends PatternListParent_ { } +class PatternListParent extends PatternListParent_ { } /** Internal implementation class */ library class PatternParent extends PatternParent_ { } diff --git a/python/ql/lib/semmle/python/Patterns.qll b/python/ql/lib/semmle/python/Patterns.qll index 3dfe80f8251..72f7235a2f7 100644 --- a/python/ql/lib/semmle/python/Patterns.qll +++ b/python/ql/lib/semmle/python/Patterns.qll @@ -7,12 +7,7 @@ import python /** A pattern in a match statement */ class Pattern extends Pattern_, AstNode { /** Gets the scope of this pattern */ - override Scope getScope() { - // TODO: Should it be defined as - // py_scopes(this, result) - // instead? - result = this.getCase().getScope() - } + override Scope getScope() { result = this.getCase().getScope() } /** Gets the case statement containing this pattern */ Case getCase() { result.contains(this) } diff --git a/python/ql/lib/semmle/python/dataflow/new/internal/DataFlowPrivate.qll b/python/ql/lib/semmle/python/dataflow/new/internal/DataFlowPrivate.qll index 39f0dfc457c..ad08a26044d 100644 --- a/python/ql/lib/semmle/python/dataflow/new/internal/DataFlowPrivate.qll +++ b/python/ql/lib/semmle/python/dataflow/new/internal/DataFlowPrivate.qll @@ -1590,8 +1590,8 @@ import IterableUnpacking * case ('quit' as c) | ('go', ('up'|'down') as c): * ...body * ``` - * `command` is the subject of the as-pattern, while the second component of `command` is the subject - * of the first capture pattern. As such, 'subject' refers to the pattern under evaluation. + * `command` is the subject of first the as-pattern, while the second component of `command` + * is the subject of the second as-pattern. As such, 'subject' refers to the pattern under evaluation. * * - as pattern: subject flows to alias as well as to the interior pattern * - or pattern: subject flows to each alternative