# File lib/yard/handlers/base.rb, line 526
      def find_or_create_macro(object_or_docstring)
        if object_or_docstring.is_a?(Docstring)
          object, docstring = nil, object_or_docstring
        else
          object, docstring = object_or_docstring, object_or_docstring.docstring
        end
        return unless macro_tag = docstring.tag(:macro)
        unless macro_tag.name
          if object
            log.warn "Invalid/missing macro name for #{object.path} (#{parser.file}:#{statement.line})"
            return nil
          else
            raise UndocumentableError, 'method/attribute, missing macro name'
          end
        end
        caller_obj = caller_method ? P(namespace, caller_method) : nil
        if macro = MacroObject.find_or_create(docstring, caller_obj)
          attached_method_name = caller_method
          if object && object.is_a?(MethodObject) && object.scope == :class
            macro.method_object = object
            attached_method_name = object.name.to_s
          end
          if macro.attached?
            globals.__attached_macros ||= {}
            globals.__attached_macros[attached_method_name] ||= []
            globals.__attached_macros[attached_method_name] |= [macro]
          end
        end
        macro
      end