1.1 --- a/micropython/inspect.py Sun Feb 26 19:36:56 2012 +0100
1.2 +++ b/micropython/inspect.py Mon Feb 27 21:51:46 2012 +0100
1.3 @@ -668,6 +668,7 @@
1.4
1.5 if expr.name == "self":
1.6 self.store_instance_attr(attrname)
1.7 + self.use_attribute(expr.name, attrname, value) # NOTE: Impose constraints on the type given the hierarchy.
1.8
1.9 elif isinstance(value, Module):
1.10 self.store_module_attr(attrname, value)
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/tests/attributes_instance_assignment.py Mon Feb 27 21:51:46 2012 +0100
2.3 @@ -0,0 +1,23 @@
2.4 +#!/usr/bin/env python
2.5 +
2.6 +class C:
2.7 + def __init__(self, x):
2.8 + self.x = x
2.9 + self.z = None
2.10 +
2.11 +class D:
2.12 + def __init__(self, y):
2.13 + self.y = y
2.14 + self.z = None
2.15 +
2.16 +def f(a):
2.17 + if a.z:
2.18 + pass
2.19 + a.x = 3
2.20 +
2.21 +c = C(1)
2.22 +d = D(2)
2.23 +f(c)
2.24 +result_3 = c.x
2.25 +
2.26 +# vim: tabstop=4 expandtab shiftwidth=4
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/tests/attributes_instance_assignment_on_self.py Mon Feb 27 21:51:46 2012 +0100
3.3 @@ -0,0 +1,23 @@
3.4 +#!/usr/bin/env python
3.5 +
3.6 +class C:
3.7 + def __init__(self, x):
3.8 + self.x = x
3.9 + self.z = None
3.10 +
3.11 + def f(self, a):
3.12 + if self.z:
3.13 + pass
3.14 + self.x = a
3.15 +
3.16 +class D:
3.17 + def __init__(self, y):
3.18 + self.y = y
3.19 + self.z = None
3.20 +
3.21 +c = C(1)
3.22 +d = D(2)
3.23 +c.f(3)
3.24 +result_3 = c.x
3.25 +
3.26 +# vim: tabstop=4 expandtab shiftwidth=4