@@ -46,12 +46,11 @@ module.exports = function inlineInvariant(context) {
46
46
} else {
47
47
path . replaceWith ( invariantTemplate ( { cond, args } ) ) ;
48
48
}
49
+ path . addComment ( 'leading' , ' istanbul ignore next ' ) ;
49
50
} else if ( calleeName === 'devAssert' ) {
50
51
const [ cond , args ] = node . arguments ;
51
52
path . replaceWith ( assertTemplate ( { cond, args } ) ) ;
52
53
}
53
-
54
- path . addComment ( 'leading' , ' istanbul ignore next ' ) ;
55
54
} ,
56
55
} ,
57
56
} ;
@@ -60,14 +59,11 @@ module.exports = function inlineInvariant(context) {
60
59
const parentStatement = path . getStatementParent ( ) ;
61
60
const previousStatement =
62
61
parentStatement . container [ parentStatement . key - 1 ] ;
63
- if ( previousStatement . type === 'IfStatement' ) {
64
- let lastIf = previousStatement ;
65
- while ( lastIf . alternate && lastIf . alternate . type === 'IfStatement' ) {
66
- lastIf = lastIf . alternate ;
67
- }
68
- if ( lastIf . alternate == null ) {
69
- t . addComment ( lastIf , 'leading' , ' istanbul ignore else ' ) ;
70
- }
62
+ if (
63
+ previousStatement . type === 'IfStatement' &&
64
+ previousStatement . alternate == null
65
+ ) {
66
+ t . addComment ( previousStatement , 'leading' , ' istanbul ignore else ' ) ;
71
67
}
72
68
}
73
69
} ;
0 commit comments