def update_name(self, name):
        """Updates the name of the custom type in this instance and its
        parent reference."""
        if name != self.name:
            self.parent.types[name] = self
            del self.parent.types[self.name]
            self.name = name