Loading lib/jsduck/js_parser.rb +3 −3 Original line number Diff line number Diff line Loading @@ -138,17 +138,17 @@ module JsDuck # True if range A is less than range B def less(a, b) return a[1] < b[0] return a[1] <= b[0] end # True if range A is greater than range B def greater(a, b) return a[0] > b[1] return a[0] >= b[1] end # True if range A is within range B def within(a, b) return b[0] < a[0] && a[1] < b[1] return b[0] <= a[0] && a[1] <= b[1] end Loading spec/js_parser_spec.rb +13 −1 Original line number Diff line number Diff line Loading @@ -256,5 +256,17 @@ describe JsDuck::JsParser do end end describe "parsing comment immediately before object literal" do before do @docs = parse(<<-EOS) x = /* Blah */{}; EOS end it "associates comment with the code" do @docs[0][:comment].should == " Blah " @docs[0][:code]["type"].should == "ObjectExpression" end end end Loading
lib/jsduck/js_parser.rb +3 −3 Original line number Diff line number Diff line Loading @@ -138,17 +138,17 @@ module JsDuck # True if range A is less than range B def less(a, b) return a[1] < b[0] return a[1] <= b[0] end # True if range A is greater than range B def greater(a, b) return a[0] > b[1] return a[0] >= b[1] end # True if range A is within range B def within(a, b) return b[0] < a[0] && a[1] < b[1] return b[0] <= a[0] && a[1] <= b[1] end Loading
spec/js_parser_spec.rb +13 −1 Original line number Diff line number Diff line Loading @@ -256,5 +256,17 @@ describe JsDuck::JsParser do end end describe "parsing comment immediately before object literal" do before do @docs = parse(<<-EOS) x = /* Blah */{}; EOS end it "associates comment with the code" do @docs[0][:comment].should == " Blah " @docs[0][:code]["type"].should == "ObjectExpression" end end end