Skip to content

Commit

Permalink
fix: address regression discussed in istanbuljs/babel-plugin-istanbul#78
Browse files Browse the repository at this point in the history
 (#40)
  • Loading branch information
bcoe committed Jan 4, 2017
1 parent a7286b0 commit 7f458a3
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/visitor.js
Expand Up @@ -145,9 +145,12 @@ class VisitState {
} else if (path.isStatement()) {
path.insertBefore(T.expressionStatement(increment));
} else if ((path.isFunctionExpression() || path.isArrowFunctionExpression()) && T.isVariableDeclarator(path.parentPath)) {
path.parentPath.parentPath.insertBefore(T.expressionStatement(
increment
));
const parent = path.findParent((path) => path.parentPath.isProgram());
if (parent) {
parent.insertBefore(T.expressionStatement(
increment
));
}
} else /* istanbul ignore else: not expected */ if (path.isExpression()) {
path.replaceWith(T.sequenceExpression([increment, path.node]));
} else {
Expand Down

0 comments on commit 7f458a3

Please sign in to comment.