romanofski/programslice

Slicing: Improve quality

Closed this issue · 1 comments

The slicing quality is currently poor. The dependency graph is created based on variable occurrences. We need to improve both graph and the visitor to give better results for programs e.g:

def unrelated():
    """
    Function which returns a, but the slicing result on a should return
    only the first and last line.
    """
    a = 1
    b = 2
    c = 2 * b
    a = a - b
    a = a + c
    a = a - b
    a = 5
    return a

This actually outlines a bug with 79f495a

If I start a slice at c = 2 * b it highlights the c three lines down: a = a + c, but doesn't go further. I'd expect the dependency now going down with the next lines including a