Loading lib/jsduck/parser.rb +8 −3 Original line number Diff line number Diff line Loading @@ -65,7 +65,7 @@ module JsDuck var_declaration elsif look(:ident, ":") || look(:string, ":") then property_literal elsif look(:ident) then elsif look(:ident) || look("this") then maybe_assignment elsif look(:string) then {:type => :assignment, :left => [match(:string)]} Loading Loading @@ -121,9 +121,14 @@ module JsDuck } end # <ident-chain> := <ident> [ "." <ident> ]* # <ident-chain> := [ "this" | <ident> ] [ "." <ident> ]* def ident_chain if look("this") chain = [match("this")] else chain = [match(:ident)] end while look(".", :ident) do chain << match(".", :ident) end Loading test/tc_jsduck.rb +13 −0 Original line number Diff line number Diff line Loading @@ -399,6 +399,19 @@ foo: true, assert_equal("My comment", docs[0][:doc]) end def test_property_ident_chain_begins_with_this docs = JsDuck.parse(" /** * If true then lock actions */ this.locked = false; ") assert_equal(:property, docs[0][:tagname]) assert_equal("locked", docs[0][:name]) assert_equal("Boolean", docs[0][:type]) assert_equal("If true then lock actions", docs[0][:doc]) end def test_implicit_property_type comment = " /** Loading Loading
lib/jsduck/parser.rb +8 −3 Original line number Diff line number Diff line Loading @@ -65,7 +65,7 @@ module JsDuck var_declaration elsif look(:ident, ":") || look(:string, ":") then property_literal elsif look(:ident) then elsif look(:ident) || look("this") then maybe_assignment elsif look(:string) then {:type => :assignment, :left => [match(:string)]} Loading Loading @@ -121,9 +121,14 @@ module JsDuck } end # <ident-chain> := <ident> [ "." <ident> ]* # <ident-chain> := [ "this" | <ident> ] [ "." <ident> ]* def ident_chain if look("this") chain = [match("this")] else chain = [match(:ident)] end while look(".", :ident) do chain << match(".", :ident) end Loading
test/tc_jsduck.rb +13 −0 Original line number Diff line number Diff line Loading @@ -399,6 +399,19 @@ foo: true, assert_equal("My comment", docs[0][:doc]) end def test_property_ident_chain_begins_with_this docs = JsDuck.parse(" /** * If true then lock actions */ this.locked = false; ") assert_equal(:property, docs[0][:tagname]) assert_equal("locked", docs[0][:name]) assert_equal("Boolean", docs[0][:type]) assert_equal("If true then lock actions", docs[0][:doc]) end def test_implicit_property_type comment = " /** Loading