@@ -88,11 +88,11 @@ module.exports = {
88
88
// s2_4:
89
89
// { good: false,
90
90
// loc: <loc> } } } ]
91
- var funcInfoStack = [ ]
91
+ const funcInfoStack = [ ]
92
92
93
93
function markCurrentBranchAsGood ( ) {
94
- var funcInfo = peek ( funcInfoStack )
95
- var currentBranchID = peek ( funcInfo . branchIDStack )
94
+ const funcInfo = peek ( funcInfoStack )
95
+ const currentBranchID = peek ( funcInfo . branchIDStack )
96
96
if ( funcInfo . branchInfoMap [ currentBranchID ] ) {
97
97
funcInfo . branchInfoMap [ currentBranchID ] . good = true
98
98
}
@@ -104,13 +104,13 @@ module.exports = {
104
104
ThrowStatement : markCurrentBranchAsGood ,
105
105
106
106
onCodePathSegmentStart : function ( segment , node ) {
107
- var funcInfo = peek ( funcInfoStack )
107
+ const funcInfo = peek ( funcInfoStack )
108
108
funcInfo . branchIDStack . push ( segment . id )
109
109
funcInfo . branchInfoMap [ segment . id ] = { good : false , node : node }
110
110
} ,
111
111
112
112
onCodePathSegmentEnd : function ( segment , node ) {
113
- var funcInfo = peek ( funcInfoStack )
113
+ const funcInfo = peek ( funcInfoStack )
114
114
funcInfo . branchIDStack . pop ( )
115
115
} ,
116
116
@@ -122,24 +122,24 @@ module.exports = {
122
122
} ,
123
123
124
124
onCodePathEnd : function ( path , node ) {
125
- var funcInfo = funcInfoStack . pop ( )
125
+ const funcInfo = funcInfoStack . pop ( )
126
126
127
127
if ( ! isInlineThenFunctionExpression ( node ) ) {
128
128
return
129
129
}
130
130
131
131
path . finalSegments . forEach ( segment => {
132
- var id = segment . id
133
- var branch = funcInfo . branchInfoMap [ id ]
132
+ const id = segment . id
133
+ const branch = funcInfo . branchInfoMap [ id ]
134
134
if ( ! branch . good ) {
135
135
if ( hasParentReturnStatement ( branch . node ) ) {
136
136
return
137
137
}
138
138
139
139
// check shortcircuit syntax like `x && x()` and `y || x()``
140
- var prevSegments = segment . prevSegments
141
- for ( var ii = prevSegments . length - 1 ; ii >= 0 ; -- ii ) {
142
- var prevSegment = prevSegments [ ii ]
140
+ const prevSegments = segment . prevSegments
141
+ for ( let ii = prevSegments . length - 1 ; ii >= 0 ; -- ii ) {
142
+ const prevSegment = prevSegments [ ii ]
143
143
if ( funcInfo . branchInfoMap [ prevSegment . id ] . good ) return
144
144
}
145
145
0 commit comments