Loading lib/jsduck/function_ast.rb +1 −1 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ module JsDuck end def return_this?(ast) return?(ast) && this?(ast["argument"]) return?(ast) && !!ast["argument"] && this?(ast["argument"]) end def return?(ast) Loading spec/function_ast_spec.rb +4 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,10 @@ describe "JsDuck::FunctionAst#chainable?" do chainable?("/** */ function foo() {}").should == false end it "false when body has empty return statement" do chainable?("/** */ function foo() { return; }").should == false end it "true when single RETURN THIS statement in body" do chainable?("/** */ function foo() {return this;}").should == true end Loading Loading
lib/jsduck/function_ast.rb +1 −1 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ module JsDuck end def return_this?(ast) return?(ast) && this?(ast["argument"]) return?(ast) && !!ast["argument"] && this?(ast["argument"]) end def return?(ast) Loading
spec/function_ast_spec.rb +4 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,10 @@ describe "JsDuck::FunctionAst#chainable?" do chainable?("/** */ function foo() {}").should == false end it "false when body has empty return statement" do chainable?("/** */ function foo() { return; }").should == false end it "true when single RETURN THIS statement in body" do chainable?("/** */ function foo() {return this;}").should == true end Loading