# HG changeset patch # User Paul Boddie # Date 1485039388 -3600 # Node ID 9e10f6c6dd27efd00e09368aca9ef257fb915d5f # Parent a89ee0f5895d7d0abe85b6f26f9804ea1b08b1b8 Replaced __mname__ with __oname__ to provide class and function locations. diff -r a89ee0f5895d -r 9e10f6c6dd27 generator.py --- a/generator.py Sat Jan 21 17:03:55 2017 +0100 +++ b/generator.py Sat Jan 21 23:56:28 2017 +0100 @@ -914,7 +914,7 @@ # Special cases. - elif attrname in ("__file__", "__fname__", "__mname__", "__name__"): + elif attrname in ("__file__", "__fname__", "__mname__", "__name__", "__oname__"): path = ref.get_origin() value_type = self.string_type @@ -930,11 +930,11 @@ elif attrname in ("__fname__", "__name__"): value = path.rsplit(".", 1)[-1] - # Module names of classes and functions are derived from + # Object names of classes and functions are derived from # their object paths. - elif attrname == "__mname__" and not ref.has_kind(""): - value = self.importer.get_module_provider(ref) + elif attrname == "__oname__": + value = path.rsplit(".", 1)[0] # All other names just use the object path information. diff -r a89ee0f5895d -r 9e10f6c6dd27 importer.py --- a/importer.py Sat Jan 21 17:03:55 2017 +0100 +++ b/importer.py Sat Jan 21 23:56:28 2017 +0100 @@ -607,7 +607,7 @@ # NOTE: Consolidate this information in a common location. - special_attributes = ("__args__", "__file__", "__fn__", "__fname__", "__mname__", "__name__") + special_attributes = ("__args__", "__file__", "__fn__", "__fname__", "__mname__", "__name__", "__oname__") def is_dynamic(self, ref): return not ref or not ref.static() and not ref.is_constant_alias() and not ref.is_predefined_value() diff -r a89ee0f5895d -r 9e10f6c6dd27 inspector.py --- a/inspector.py Sat Jan 21 17:03:55 2017 +0100 +++ b/inspector.py Sat Jan 21 23:56:28 2017 +0100 @@ -524,10 +524,10 @@ self.set_name("__fn__") # special instantiator attribute self.set_name("__args__") # special instantiator attribute - # Provide leafname and module name attributes. + # Provide leafname and object name attributes. self.set_name("__name__", self.get_constant("string", class_name.rsplit(".", 1)[-1]).reference()) - self.set_name("__mname__", self.get_constant("string", self.name).reference()) + self.set_name("__oname__", self.get_constant("string", class_name.rsplit(".", 1)[0]).reference()) self.process_structure_node(n.code) self.exit_namespace() @@ -646,11 +646,11 @@ self.enter_namespace(name) - # Define leafname and module name attribute values for the function instance. + # Define leafname and object name attribute values for the function instance. ref = self.get_builtin_class("string") self.reserve_constant(function_name, name, ref.get_origin()) - self.reserve_constant(function_name, self.name, ref.get_origin()) + self.reserve_constant(function_name, function_name.rsplit(".", 1)[0], ref.get_origin()) # Track attribute usage within the namespace. diff -r a89ee0f5895d -r 9e10f6c6dd27 lib/__builtins__/core.py --- a/lib/__builtins__/core.py Sat Jan 21 17:03:55 2017 +0100 +++ b/lib/__builtins__/core.py Sat Jan 21 23:56:28 2017 +0100 @@ -41,7 +41,7 @@ "Return a string representation." - return str(buffer(["<", self.__mname__, ".", self.__name__, " instance>"])) + return str(buffer(["<", self.__oname__, ".", self.__name__, " instance>"])) __repr__ = __str__ @@ -82,7 +82,7 @@ self.__fn__ = None self.__args__ = None self.__fname__ = None - self.__mname__ = None + self.__oname__ = None def __bool__(self): @@ -94,7 +94,7 @@ "Return a string representation." - return str(buffer([self.__mname__, ".", self.__fname__])) + return str(buffer([self.__oname__, ".", self.__fname__])) __repr__ = __str__ @@ -110,7 +110,7 @@ "Return a string representation." - return self.__name__ + return str(buffer([self.__oname__, ".", self.__name__])) __repr__ = __str__