Skip to content

Commit

Permalink
More tests
Browse files Browse the repository at this point in the history
  • Loading branch information
KuechA committed Oct 17, 2024
1 parent 487b38e commit 4a3607e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,17 +147,16 @@ class DFGPass(ctx: TranslationContext) : ComponentPass(ctx) {
* `comprehension.statement`.
*/
protected fun handleCollectionComprehension(comprehension: CollectionComprehension) {
if (comprehension.comprehensionExpressions.size > 1) {
if (comprehension.comprehensionExpressions.isNotEmpty()) {
comprehension.comprehensionExpressions
.subList(0, comprehension.comprehensionExpressions.size - 2)
.subList(0, comprehension.comprehensionExpressions.size - 1)
.forEachIndexed { i, expr ->
expr.nextDFG += comprehension.comprehensionExpressions[i + 1]
}
}
if (comprehension.comprehensionExpressions.isNotEmpty())
comprehension.statement?.let {
comprehension.comprehensionExpressions.last().nextDFG += it
}
}
comprehension.statement?.let { comprehension.prevDFG += it }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ class UnwrappedEdgeListTest {
assertEquals(1, node2.prevEOGEdges.size)
assertEquals(1, node3.prevEOGEdges.size)
assertEquals(1, node3.prevEOG.size)

assertEquals(listOf<Node>(node2, node3), node1.nextEOG.subList(0, 2))
assertEquals(listOf<Node>(node1), node3.prevEOG.subList(0, 1))
}
}

Expand Down

0 comments on commit 4a3607e

Please sign in to comment.