lib/parser/source/comment.rb in parser-3.0.1.0 vs lib/parser/source/comment.rb in parser-3.0.1.1
- old
+ new
@@ -47,9 +47,22 @@
associator = Associator.new(ast, comments)
associator.associate_locations
end
##
+ # Associate `comments` with `ast` nodes using identity.
+ #
+ # @param [Parser::AST::Node] ast
+ # @param [Array<Comment>] comments
+ # @return [Hash<Parser::Source::Node, Array<Comment>>]
+ # @see Parser::Source::Comment::Associator#associate_by_identity
+ #
+ def self.associate_by_identity(ast, comments)
+ associator = Associator.new(ast, comments)
+ associator.associate_by_identity
+ end
+
+ ##
# @param [Parser::Source::Range] range
#
def initialize(range)
@location = Parser::Source::Map.new(range)
@text = range.source.freeze