This will be a large MR.
Currently rattr does not properly handle comprehensions and nested functions.
def fn(a):
def inner(b):
b.attr = 4
return inner(a)
The above code snippet should give a.attr in the results but it gives b.attr. This is because functions are followed using the functions present in the function IR (i.e. the functions defined in the root context). The same problem is present for the contexts within list comprehensions for example:
should give thing.a[].attr in the results.
This could be achieved by storing the definitions and calls to functions under more specific names, such as fn:inner:<lineno> rather than inner. This should be generalised to handle anonymous lambdas (though only under certain circumstances).
NOTE
Possible duplicate of, or overlap with, #4
This will be a large MR.
Currently rattr does not properly handle comprehensions and nested functions.
The above code snippet should give
a.attrin the results but it givesb.attr. This is because functions are followed using the functions present in the function IR (i.e. the functions defined in the root context). The same problem is present for the contexts within list comprehensions for example:should give
thing.a[].attrin the results.This could be achieved by storing the definitions and calls to functions under more specific names, such as
fn:inner:<lineno>rather thaninner. This should be generalised to handle anonymous lambdas (though only under certain circumstances).NOTE
Possible duplicate of, or overlap with, #4