@@ -34,24 +34,6 @@ function isInlineThenFunctionExpression(node) {
34
34
)
35
35
}
36
36
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
-
55
37
function peek ( arr ) {
56
38
return arr [ arr . length - 1 ]
57
39
}
@@ -106,8 +88,8 @@ module.exports = {
106
88
}
107
89
108
90
return {
109
- ReturnStatement : markCurrentBranchAsGood ,
110
- ThrowStatement : markCurrentBranchAsGood ,
91
+ ' ReturnStatement:exit' : markCurrentBranchAsGood ,
92
+ ' ThrowStatement:exit' : markCurrentBranchAsGood ,
111
93
112
94
onCodePathSegmentStart ( segment , node ) {
113
95
const funcInfo = peek ( funcInfoStack )
@@ -138,10 +120,6 @@ module.exports = {
138
120
const id = segment . id
139
121
const branch = funcInfo . branchInfoMap [ id ]
140
122
if ( ! branch . good ) {
141
- if ( hasParentReturnStatement ( branch . node ) ) {
142
- return
143
- }
144
-
145
123
context . report ( {
146
124
message : 'Each then() should return a value or throw' ,
147
125
node : branch . node ,
0 commit comments