lib/yard/parser/source_parser.rb in yard-0.7.2 vs lib/yard/parser/source_parser.rb in yard-0.7.3

- old
+ new

@@ -16,11 +16,20 @@ # A LoadOrderError occurs when a handler needs to modify a # {CodeObjects::NamespaceObject} (usually by adding a child to it) # that has not yet been resolved. # # @see Handers::Base#ensure_loaded! - class LoadOrderError < Exception; end + class LoadOrderError < Exception + # @return [Continuation] the context representing the + # point at which the load order error occurred. + attr_accessor :context + + # @param [Continuation] context see {#context} + def initialize(context) + @context = context + end + end # Responsible for parsing a source file into the namespace. Parsing # also invokes handlers to process the parsed statements and generate # any code objects that may be recognized. # @@ -351,11 +360,11 @@ log.debug("Processing #{file}...") new(parser_type, true, global_state).parse(file) end rescue LoadOrderError => e # Out of order file. Push the context to the end and we'll call it - files.push([file, e.message]) + files.push([file, e.context]) end end after_parse_list_callbacks.each do |cb| cb.call(files_copy, global_state) @@ -434,11 +443,13 @@ end @parser rescue ArgumentError, NotImplementedError => e log.warn("Cannot parse `#{file}': #{e.message}") + log.backtrace(e) if log.level >= Logger::DEBUG rescue ParserSyntaxError => e log.warn(e.message.capitalize) + log.backtrace(e) if log.level >= Logger::DEBUG end # Tokenizes but does not parse the block of code using the current {#parser_type} # # @param [String] content the block of code to tokenize