1.1 --- a/generator.py Sun Jan 22 01:16:01 2017 +0100
1.2 +++ b/generator.py Sun Jan 22 21:46:37 2017 +0100
1.3 @@ -914,7 +914,7 @@
1.4
1.5 # Special cases.
1.6
1.7 - elif attrname in ("__file__", "__fname__", "__mname__", "__name__", "__oname__"):
1.8 + elif attrname in ("__file__", "__name__"):
1.9 path = ref.get_origin()
1.10 value_type = self.string_type
1.11
1.12 @@ -927,15 +927,9 @@
1.13
1.14 # Function and class names are leafnames.
1.15
1.16 - elif attrname in ("__fname__", "__name__"):
1.17 + elif attrname == "__name__" and not ref.has_kind("<module>"):
1.18 value = path.rsplit(".", 1)[-1]
1.19
1.20 - # Object names of classes and functions are derived from
1.21 - # their object paths.
1.22 -
1.23 - elif attrname == "__oname__":
1.24 - value = path.rsplit(".", 1)[0]
1.25 -
1.26 # All other names just use the object path information.
1.27
1.28 else:
1.29 @@ -951,6 +945,16 @@
1.30 structure.append("%s /* %s */" % (constant_value, attrname))
1.31 continue
1.32
1.33 + elif attrname == "__parent__":
1.34 + path = ref.get_origin()
1.35 +
1.36 + # Parents of classes and functions are derived from their
1.37 + # object paths.
1.38 +
1.39 + value = path.rsplit(".", 1)[0]
1.40 + structure.append("{.context=0, .value=&%s}" % encode_path(value))
1.41 + continue
1.42 +
1.43 # Special class relationship attributes.
1.44
1.45 elif is_type_attribute(attrname):