code: def _add_dependency(self, key, dependlist, i, isSubroutine, anexec):
          
          #First determine if the reference is to a derived type variable
          lkey = key.lower()
          if "%" in key:
              #Find the type of the base variable and then perform a tree
              #search at the module level to determine if the final reference
              #is a valid executable
              base = key.split("%")[0]
              ftype = None
              if base in anexec.members and anexec.members[base].is_custom:
                  ftype = anexec.members[base].kind
              elif base in anexec.parameters and anexec.parameters[base].is_custom:
                  ftype = anexec.parameters[base].kind
  
              if ftype is not None:
                  end = anexec.module.type_search(ftype, key)
                  if end is not None and isinstance(end, TypeExecutable):
                      #We have to overwrite the key to include the actual name of the type
                      #that is being referenced instead of the local name of its variable.
                      tname = "{}%{}".format(ftype, '%'.join(key.split('%')[1:]))
                      d = Dependency(tname, dependlist[i + 1], isSubroutine, anexec)
                      anexec.add_dependency(d)
                      
          elif lkey not in ["for", "forall", "do"]:
              #This is a straight forward function/subroutine call, make sure that
              #the symbol is not a local variable or parameter, then add it
              if not lkey in anexec.members and not lkey in anexec.parameters \
                 and not lkey in self._intrinsic:                
                  #One issue with the logic until now is that some one-line statements
                  #like "if (cond) call subroutine" don't trigger the subroutine flag
                  #of the dependency.
                  if dependlist[i-1] == "call":
                      isSubroutine = True
                  d = Dependency(dependlist[i], dependlist[i + 1], isSubroutine, anexec)
                  anexec.add_dependency(d)
docs: Determines whether the item in the dependency list is a valid function
          call by excluding local variables and members.