Commit 1735d1f0 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Comment on why the raw AST node comparison is needed.

After messing a lot with trying to move AstNode object creation
straight to JsParser class, I discovered that it might not be the best idea.
parent a114e5dc
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -299,9 +299,13 @@ module JsDuck

    # Looks up docset associated with given AST node.
    # A dead-stupid and -slow implementation, but works.
    def find_docset(ast)
    #
    # The comparison needs to be done between raw AST nodes - multiple
    # AstNode instances can be created to wrap a single raw AST node,
    # and they will then not be equal.
    def find_docset(raw_ast)
      @docs.find do |docset|
        docset[:code] == ast
        docset[:code] == raw_ast
      end
    end