@@ -168,6 +168,37 @@ private predicate synthDictSplatArgumentNodeStoreStep(
168168 )
169169}
170170
171+ private predicate yieldStoreStep ( Node nodeFrom , Content c , Node nodeTo ) {
172+ exists ( Yield yield , Function func |
173+ nodeTo .asCfgNode ( ) = yield .getAFlowNode ( ) and
174+ nodeFrom .asCfgNode ( ) = yield .getValue ( ) .getAFlowNode ( ) and
175+ func .containsInScope ( yield )
176+ |
177+ exists ( Comp comp | func = comp .getFunction ( ) |
178+ (
179+ comp instanceof ListComp or
180+ comp instanceof GeneratorExp
181+ ) and
182+ c instanceof ListElementContent
183+ or
184+ comp instanceof SetComp and
185+ c instanceof SetElementContent
186+ or
187+ comp instanceof DictComp and
188+ c instanceof DictionaryElementContent
189+ )
190+ or
191+ not exists ( Comp comp | func = comp .getFunction ( ) ) and
192+ (
193+ c instanceof ListElementContent
194+ or
195+ c instanceof SetElementContent
196+ or
197+ c instanceof DictionaryElementContent
198+ )
199+ )
200+ }
201+
171202/**
172203 * Ensures that the a `**kwargs` parameter will not contain elements with names of
173204 * keyword parameters.
@@ -668,8 +699,6 @@ predicate storeStep(Node nodeFrom, ContentSet c, Node nodeTo) {
668699 or
669700 setStoreStep ( nodeFrom , c , nodeTo )
670701 or
671- comprehensionStoreStep ( nodeFrom , c , nodeTo )
672- or
673702 attributeStoreStep ( nodeFrom , c , nodeTo )
674703 or
675704 matchStoreStep ( nodeFrom , c , nodeTo )
@@ -683,6 +712,8 @@ predicate storeStep(Node nodeFrom, ContentSet c, Node nodeTo) {
683712 or
684713 synthDictSplatArgumentNodeStoreStep ( nodeFrom , c , nodeTo )
685714 or
715+ yieldStoreStep ( nodeFrom , c , nodeTo )
716+ or
686717 VariableCapture:: storeStep ( nodeFrom , c , nodeTo )
687718}
688719
0 commit comments