def update_dtype(self, resvar=None):
        """Updates the dtype attribute of the function. This is required because
        fortran functions can have their types declared either as a modifier on
        the function *or* as a member inside the function.

        :arg resvar: the name of the variable declared using the result(var)
          construct after the function signature.
        """
        if self.dtype is None:
            #search the members of this function for one that has the same name
            #as the function. If it gets found, overwrite the dtype, kind and
            #modifiers attributes so the rest of the code works.
            for m in self.members:
                if m == self.name.lower() or m == resvar:
                    member = self.members[m]
                    self.dtype = member.dtype
                    self.modifiers = member.modifiers
                    self.kind = member.kind
                    self.default = member.default
                    self.dimension = member.dimension
                    del self.members[m]
                    break