From f6e243aa70cbb44563a1e9bc8a3a6fe1d97041d9 Mon Sep 17 00:00:00 2001 From: Vignesh Shanmugam Date: Fri, 29 Dec 2017 22:11:55 +0100 Subject: [PATCH] (perf) - move the collapser check before inling properties --- .../babel-plugin-transform-inline-consecutive-adds/src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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,