diff --git a/packages/babel-plugin-transform-inline-consecutive-adds/src/index.js b/packages/babel-plugin-transform-inline-consecutive-adds/src/index.js index ca59cc4a4..47cd2c7c9 100644 --- a/packages/babel-plugin-transform-inline-consecutive-adds/src/index.js +++ b/packages/babel-plugin-transform-inline-consecutive-adds/src/index.js @@ -149,11 +149,11 @@ function getReferenceChecker(references) { function tryUseCollapser(t, collapser, varDecl, topLevel, checkReference) { // Returns true iff successfully used the collapser. Otherwise returns undefined. const [name, init, startIndex] = topLevel; - const body = varDecl.parentPath.get("body"); if (!collapser.isInitTypeValid(init)) { return; } + const body = varDecl.parentPath.get("body"); const [statements, exprs] = getContiguousStatementsAndExpressions( body, startIndex + 1,