Loading doc_comment.rb +11 −1 Original line number Diff line number Diff line Loading @@ -81,6 +81,8 @@ module JsDuck at_event elsif look(/@function\b/) then at_function elsif look(/@constructor\b/) then at_constructor elsif look(/@param\b/) then at_param elsif look(/@return\b/) then Loading Loading @@ -143,7 +145,7 @@ module JsDuck skip_white end # matches @return {type} ... # matches @function name ... def at_function match(/@function/) @current_tag = @tags[:function] = {:doc => ""} Loading @@ -154,6 +156,14 @@ module JsDuck skip_white end # matches @constructor ... # Which is equivalent of: @function constructor ... def at_constructor match(/@constructor/) @current_tag = @tags[:function] = {:doc => "", :name => "constructor"} skip_white end # matches @param {type} variable ... def at_param match(/@param/) Loading tc_doc_comment.rb +9 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,15 @@ class TestDocComment < Test::Unit::TestCase assert_equal("resulting value", doc[:return][:doc]) end def test_constructor doc = JsDuck::DocComment.new("/** * @constructor * Some docs. */") assert_equal("constructor", doc[:function][:name]) assert_equal("Some docs.", doc[:function][:doc]) end def test_class doc = JsDuck::DocComment.new("/** * @class my.package.Foo Loading Loading
doc_comment.rb +11 −1 Original line number Diff line number Diff line Loading @@ -81,6 +81,8 @@ module JsDuck at_event elsif look(/@function\b/) then at_function elsif look(/@constructor\b/) then at_constructor elsif look(/@param\b/) then at_param elsif look(/@return\b/) then Loading Loading @@ -143,7 +145,7 @@ module JsDuck skip_white end # matches @return {type} ... # matches @function name ... def at_function match(/@function/) @current_tag = @tags[:function] = {:doc => ""} Loading @@ -154,6 +156,14 @@ module JsDuck skip_white end # matches @constructor ... # Which is equivalent of: @function constructor ... def at_constructor match(/@constructor/) @current_tag = @tags[:function] = {:doc => "", :name => "constructor"} skip_white end # matches @param {type} variable ... def at_param match(/@param/) Loading
tc_doc_comment.rb +9 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,15 @@ class TestDocComment < Test::Unit::TestCase assert_equal("resulting value", doc[:return][:doc]) end def test_constructor doc = JsDuck::DocComment.new("/** * @constructor * Some docs. */") assert_equal("constructor", doc[:function][:name]) assert_equal("Some docs.", doc[:function][:doc]) end def test_class doc = JsDuck::DocComment.new("/** * @class my.package.Foo Loading