Loading lib/jsduck/ast.rb +2 −2 Original line number Diff line number Diff line Loading @@ -79,7 +79,7 @@ module JsDuck make_class(to_s(var["id"]), var["right"]) # function Foo() {} elsif function?(ast) && class_name?(to_s(ast["id"])) elsif function?(ast) && ast["id"] && class_name?(to_s(ast["id"])) make_class(to_s(ast["id"])) # { ... } Loading @@ -88,7 +88,7 @@ module JsDuck # function foo() {} elsif function?(ast) make_method(to_s(ast["id"]), ast) make_method(ast["id"] ? to_s(ast["id"]) : "", ast) # foo = function() {} elsif exp && assignment?(exp) && function?(exp["right"]) Loading spec/ast_spec.rb +5 −1 Original line number Diff line number Diff line Loading @@ -90,10 +90,14 @@ describe JsDuck::Ast do detect("/** */ var foo = Ext.emptyFn").should == :method end it "anonymous function" do it "anonymous function as expression" do detect("/** */ (function(){})").should == :method end it "anonymous function as parameter" do detect("doSomething('blah', /** */ function(){});").should == :method end it "object property initialized with function" do detect(<<-EOS).should == :method Foo = { Loading Loading
lib/jsduck/ast.rb +2 −2 Original line number Diff line number Diff line Loading @@ -79,7 +79,7 @@ module JsDuck make_class(to_s(var["id"]), var["right"]) # function Foo() {} elsif function?(ast) && class_name?(to_s(ast["id"])) elsif function?(ast) && ast["id"] && class_name?(to_s(ast["id"])) make_class(to_s(ast["id"])) # { ... } Loading @@ -88,7 +88,7 @@ module JsDuck # function foo() {} elsif function?(ast) make_method(to_s(ast["id"]), ast) make_method(ast["id"] ? to_s(ast["id"]) : "", ast) # foo = function() {} elsif exp && assignment?(exp) && function?(exp["right"]) Loading
spec/ast_spec.rb +5 −1 Original line number Diff line number Diff line Loading @@ -90,10 +90,14 @@ describe JsDuck::Ast do detect("/** */ var foo = Ext.emptyFn").should == :method end it "anonymous function" do it "anonymous function as expression" do detect("/** */ (function(){})").should == :method end it "anonymous function as parameter" do detect("doSomething('blah', /** */ function(){});").should == :method end it "object property initialized with function" do detect(<<-EOS).should == :method Foo = { Loading