Loading lib/jsduck/js_parser.rb +10 −1 Original line number Diff line number Diff line Loading @@ -220,7 +220,7 @@ module JsDuck cfg end # <ext-define-cfg> := "{" ( <extend> | <mixins> | <alternate-class-name> | <alias> | <?> )* # <ext-define-cfg> := "{" ( <extend> | <mixins> | <alternate-class-name> | <alias> | <singleton> | <?> )* def ext_define_cfg match("{") cfg = {} Loading @@ -239,6 +239,9 @@ module JsDuck elsif look("alias", ":") cfg[:alias] = ext_define_alias found = true elsif look("singleton", ":", "true") cfg[:singleton] = ext_define_singleton found = true elsif look(:ident, ":") match(:ident, ":") found = literal Loading @@ -265,6 +268,12 @@ module JsDuck string_or_list end # <ext-define-singleton> := "singleton" ":" "true" def ext_define_singleton match("singleton", ":", "true") true end # <string-or-list> := ( <string> | <array-literal> ) def string_or_list lit = literal Loading lib/jsduck/merger.rb +5 −1 Original line number Diff line number Diff line Loading @@ -115,7 +115,7 @@ module JsDuck :xtypes => detect_xtypes(doc_map, code), :author => detect_author(doc_map), :docauthor => detect_docauthor(doc_map), :singleton => !!doc_map[:singleton], :singleton => detect_singleton(doc_map, code), # Used by Aggregator to determine if we're dealing with Ext4 code :code_type => code[:type], }, doc_map) Loading Loading @@ -320,6 +320,10 @@ module JsDuck doc_map[:deprecated] ? doc_map[:deprecated].first : nil end def detect_singleton(doc_map, code) !!(doc_map[:singleton] || code[:type] == :ext_define && code[:singleton]) end def detect_params(docs, code) implicit = detect_implicit_params(code) explicit = detect_explicit_params(docs) Loading spec/aggregator_classes_spec.rb +7 −2 Original line number Diff line number Diff line Loading @@ -198,6 +198,9 @@ describe JsDuck::Aggregator do it "detects implied xtype" do @doc[:xtypes].should == ["foo"] end it "detects implied singleton" do @doc[:singleton].should == true end end describe "basic Ext.define() in code" do Loading @@ -211,7 +214,8 @@ describe JsDuck::Aggregator do bar: 'Foo.Bar' }, alias: 'widget.foo', alternateClassName: 'JustClass' alternateClassName: 'JustClass', singleton: true }); EOS end Loading @@ -234,9 +238,10 @@ describe JsDuck::Aggregator do @doc = parse(<<-EOS)[0] /** */ Ext.define('MyClass', { singleton: true, blah: true, extend: 'Your.Class', alias: ['widget.foo', 'something.bar'], singleton: true, alternateClassName: ['JustClass'], requires: ['Hohooo', 'hahaa'], mixins: { Loading Loading
lib/jsduck/js_parser.rb +10 −1 Original line number Diff line number Diff line Loading @@ -220,7 +220,7 @@ module JsDuck cfg end # <ext-define-cfg> := "{" ( <extend> | <mixins> | <alternate-class-name> | <alias> | <?> )* # <ext-define-cfg> := "{" ( <extend> | <mixins> | <alternate-class-name> | <alias> | <singleton> | <?> )* def ext_define_cfg match("{") cfg = {} Loading @@ -239,6 +239,9 @@ module JsDuck elsif look("alias", ":") cfg[:alias] = ext_define_alias found = true elsif look("singleton", ":", "true") cfg[:singleton] = ext_define_singleton found = true elsif look(:ident, ":") match(:ident, ":") found = literal Loading @@ -265,6 +268,12 @@ module JsDuck string_or_list end # <ext-define-singleton> := "singleton" ":" "true" def ext_define_singleton match("singleton", ":", "true") true end # <string-or-list> := ( <string> | <array-literal> ) def string_or_list lit = literal Loading
lib/jsduck/merger.rb +5 −1 Original line number Diff line number Diff line Loading @@ -115,7 +115,7 @@ module JsDuck :xtypes => detect_xtypes(doc_map, code), :author => detect_author(doc_map), :docauthor => detect_docauthor(doc_map), :singleton => !!doc_map[:singleton], :singleton => detect_singleton(doc_map, code), # Used by Aggregator to determine if we're dealing with Ext4 code :code_type => code[:type], }, doc_map) Loading Loading @@ -320,6 +320,10 @@ module JsDuck doc_map[:deprecated] ? doc_map[:deprecated].first : nil end def detect_singleton(doc_map, code) !!(doc_map[:singleton] || code[:type] == :ext_define && code[:singleton]) end def detect_params(docs, code) implicit = detect_implicit_params(code) explicit = detect_explicit_params(docs) Loading
spec/aggregator_classes_spec.rb +7 −2 Original line number Diff line number Diff line Loading @@ -198,6 +198,9 @@ describe JsDuck::Aggregator do it "detects implied xtype" do @doc[:xtypes].should == ["foo"] end it "detects implied singleton" do @doc[:singleton].should == true end end describe "basic Ext.define() in code" do Loading @@ -211,7 +214,8 @@ describe JsDuck::Aggregator do bar: 'Foo.Bar' }, alias: 'widget.foo', alternateClassName: 'JustClass' alternateClassName: 'JustClass', singleton: true }); EOS end Loading @@ -234,9 +238,10 @@ describe JsDuck::Aggregator do @doc = parse(<<-EOS)[0] /** */ Ext.define('MyClass', { singleton: true, blah: true, extend: 'Your.Class', alias: ['widget.foo', 'something.bar'], singleton: true, alternateClassName: ['JustClass'], requires: ['Hohooo', 'hahaa'], mixins: { Loading