Loading lib/jsduck/ast.rb +9 −1 Original line number Diff line number Diff line Loading @@ -194,10 +194,18 @@ module JsDuck return { :type => :method, :name => name, :params => (ast && !empty_fn?(ast)) ? ast["params"].map {|p| to_s(p) } : [] :params => make_params(ast) } end def make_params(ast) if ast && !empty_fn?(ast) ast["params"].map {|p| {:name => to_s(p)} } else [] end end def make_property(name=nil, ast=nil) return { :type => :property, Loading spec/ast_method_spec.rb +3 −3 Original line number Diff line number Diff line Loading @@ -89,9 +89,9 @@ describe "JsDuck::Ast detects method with" do describe "param names" do it "function assignment with three params" do params = detect("/** */ foo = function(a, b, c){}")[:params] params[0].should == "a" params[1].should == "b" params[2].should == "c" params[0].should == {:name => "a"} params[1].should == {:name => "b"} params[2].should == {:name => "c"} end end Loading Loading
lib/jsduck/ast.rb +9 −1 Original line number Diff line number Diff line Loading @@ -194,10 +194,18 @@ module JsDuck return { :type => :method, :name => name, :params => (ast && !empty_fn?(ast)) ? ast["params"].map {|p| to_s(p) } : [] :params => make_params(ast) } end def make_params(ast) if ast && !empty_fn?(ast) ast["params"].map {|p| {:name => to_s(p)} } else [] end end def make_property(name=nil, ast=nil) return { :type => :property, Loading
spec/ast_method_spec.rb +3 −3 Original line number Diff line number Diff line Loading @@ -89,9 +89,9 @@ describe "JsDuck::Ast detects method with" do describe "param names" do it "function assignment with three params" do params = detect("/** */ foo = function(a, b, c){}")[:params] params[0].should == "a" params[1].should == "b" params[2].should == "c" params[0].should == {:name => "a"} params[1].should == {:name => "b"} params[2].should == {:name => "c"} end end Loading