@@ -1107,7 +1107,6 @@ predicate subscriptReadStep(CfgNode nodeFrom, Content c, CfgNode nodeTo) {
11071107 *
11081108 * 6. [Store] Content is stored from `TIterableElement(v)` to the essa variable for `v`, with
11091109 * content type `ListElementContent`.
1110- * (We will see this in step 7)
11111110 *
11121111 * 7. [Flow, Read, Store] Steps 2 through 7 are repeated for all recursive elements which are sequences.
11131112 *
@@ -1183,15 +1182,23 @@ module UnpackingAssignment {
11831182 ControlFlowNode getAnElement ( ) { result = this .getElement ( _) }
11841183 }
11851184
1186- /** Step 2 */
1185+ /**
1186+ * Step 2
1187+ * Data flows from `TIterableSequence(sequence)` to `sequence`
1188+ */
11871189 predicate unpackingAssignmentFlowStep ( Node nodeFrom , Node nodeTo ) {
11881190 exists ( UnpackingAssignmentSequenceTarget target |
11891191 nodeFrom = TIterableSequenceNode ( target ) and
11901192 nodeTo .asCfgNode ( ) = target
11911193 )
11921194 }
11931195
1194- /** Step 3 */
1196+ /**
1197+ * Step 3
1198+ * Data flows from `TIterableSequence(sequence)` into `TIterableElement(sequence)`.
1199+ * If `sequence` is of type tuple, we will not read tuple content as that would allow
1200+ * cross talk.
1201+ */
11951202 predicate unpackingAssignmentConvertingReadStep ( Node nodeFrom , Content c , Node nodeTo ) {
11961203 exists ( UnpackingAssignmentSequenceTarget target |
11971204 nodeFrom = TIterableSequenceNode ( target ) and
@@ -1212,7 +1219,11 @@ module UnpackingAssignment {
12121219 )
12131220 }
12141221
1215- /** Step 4 */
1222+ /**
1223+ * Step 4
1224+ * Data flows from `TIterableElement(sequence)` to `sequence`.
1225+ * The content type is chosen according to the type of sequence.
1226+ */
12161227 predicate unpackingAssignmentConvertingStoreStep ( Node nodeFrom , Content c , Node nodeTo ) {
12171228 exists ( UnpackingAssignmentSequenceTarget target |
12181229 nodeFrom = TIterableElementNode ( target ) and
@@ -1229,7 +1240,16 @@ module UnpackingAssignment {
12291240 )
12301241 }
12311242
1232- /** Step 5 */
1243+ /**
1244+ * Step 5
1245+ * For a sequence node inside an iterable unpacking, data flows from the sequence to its elements. There are
1246+ * three cases for what `toNode` should be:
1247+ * a) If the element is a plain variable, `toNode` is the corresponding essa node.
1248+ *
1249+ * b) If the element is itelf a sequence, with control-flow node `seq`, `toNode` is `TIterableSequence(seq)`.
1250+ *
1251+ * c) If the element is a starred variable, with control-flow node `v`, `toNode` is `TIterableElement(v)`.
1252+ */
12331253 predicate unpackingAssignmentElementReadStep ( Node nodeFrom , Content c , Node nodeTo ) {
12341254 exists (
12351255 UnpackingAssignmentSequenceTarget target , int index , ControlFlowNode element , boolean precise
@@ -1266,7 +1286,11 @@ module UnpackingAssignment {
12661286 )
12671287 }
12681288
1269- /** Step 6 */
1289+ /**
1290+ * Step 6
1291+ * Data flows from `TIterableElement(v)` to the essa variable for `v`, with
1292+ * content type `ListElementContent`.
1293+ */
12701294 predicate unpackingAssignmentStarredElementStoreStep ( Node nodeFrom , Content c , Node nodeTo ) {
12711295 exists ( ControlFlowNode starred | starred .getNode ( ) instanceof Starred |
12721296 nodeFrom = TIterableElementNode ( starred ) and
0 commit comments