Commit b229d6cf authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Ignore empty multi-line comments: /**/

A corner case that wasn't taken care of.
parent 77df0390
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -140,7 +140,7 @@ module JsDuck
        elsif @input.check(/\//)
          # Several things begin with dash:
          # - comments, regexes, division-operators
          if @input.check(/\/\*\*/)
          if @input.check(/\/\*\*[^\/]/)
            return {
              :type => :doc_comment,
              # Calculate current line number, starting with 1
+4 −0
Original line number Diff line number Diff line
@@ -127,6 +127,10 @@ describe JsDuck::Lexer do
    lex("a /* foo */ b").should == [[:ident, "a"], [:ident, "b"]]
  end

  it "ignores empty multi-line comments" do
    lex("a /**/ b").should == [[:ident, "a"], [:ident, "b"]]
  end

  it "identifies doc-comments together with line numbers" do
    lex("/** foo */").should == [[:doc_comment, "/** foo */", 1]]
  end