@@ -34,24 +34,6 @@ function isInlineThenFunctionExpression(node) {
3434 )
3535}
3636
37- function hasParentReturnStatement ( node ) {
38- // istanbul ignore else -- not reachable given not checking `Program`
39- if ( node && node . parent && node . parent . type ) {
40- // if the parent is a then, and we haven't returned anything, fail
41- if ( isThenCallExpression ( node . parent ) ) {
42- return false
43- }
44-
45- if ( node . parent . type === 'ReturnStatement' ) {
46- return true
47- }
48- return hasParentReturnStatement ( node . parent )
49- }
50-
51- // istanbul ignore next -- not reachable given not checking `Program`
52- return false
53- }
54-
5537function peek ( arr ) {
5638 return arr [ arr . length - 1 ]
5739}
@@ -106,8 +88,8 @@ module.exports = {
10688 }
10789
10890 return {
109- ReturnStatement : markCurrentBranchAsGood ,
110- ThrowStatement : markCurrentBranchAsGood ,
91+ ' ReturnStatement:exit' : markCurrentBranchAsGood ,
92+ ' ThrowStatement:exit' : markCurrentBranchAsGood ,
11193
11294 onCodePathSegmentStart ( segment , node ) {
11395 const funcInfo = peek ( funcInfoStack )
@@ -138,10 +120,6 @@ module.exports = {
138120 const id = segment . id
139121 const branch = funcInfo . branchInfoMap [ id ]
140122 if ( ! branch . good ) {
141- if ( hasParentReturnStatement ( branch . node ) ) {
142- return
143- }
144-
145123 context . report ( {
146124 message : 'Each then() should return a value or throw' ,
147125 node : branch . node ,
0 commit comments