1.1 --- a/generator.py Wed Oct 26 13:09:44 2016 +0200
1.2 +++ b/generator.py Wed Oct 26 16:36:17 2016 +0200
1.3 @@ -774,13 +774,17 @@
1.4 return "{0, 0} /* %s */" % name
1.5
1.6 # Set the context depending on the kind of attribute.
1.7 - # For methods: {&<path>, &<attr>}
1.8 + # For methods: {&<parent>, &<attr>}
1.9 # For other attributes: {&<attr>, &<attr>}
1.10
1.11 else:
1.12 - context = (kind == "<function>" and structure_type == "<class>" and \
1.13 - "&%s" % encode_path(path) or "0") or \
1.14 - kind == "<instance>" and "&%s" % encode_path(origin) or "0"
1.15 + if kind == "<function>" and structure_type == "<class>":
1.16 + parent = origin.rsplit(".", 1)[0]
1.17 + context = "&%s" % encode_path(parent)
1.18 + elif kind == "<instance>":
1.19 + context = "&%s" % encode_path(origin)
1.20 + else:
1.21 + context = "0"
1.22 return "{%s, &%s}" % (context, encode_path(origin))
1.23
1.24 def append_defaults(self, path, structure):