From 24f55df7f200d6c7c0c73ae6e179782b81ec2c9e Mon Sep 17 00:00:00 2001 From: Jhen Date: Sat, 6 May 2017 03:10:56 +0800 Subject: [PATCH] Fix collapse computed properties with circular reference --- .../src/object-collapser.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/babel-plugin-transform-inline-consecutive-adds/src/object-collapser.js b/packages/babel-plugin-transform-inline-consecutive-adds/src/object-collapser.js index cd0277321..bcbba40f3 100644 --- a/packages/babel-plugin-transform-inline-consecutive-adds/src/object-collapser.js +++ b/packages/babel-plugin-transform-inline-consecutive-adds/src/object-collapser.js @@ -39,6 +39,9 @@ class ObjectCollapser extends Collapser { if (checkReference(right)) { return false; } + if (obj.isIdentifier() && right.isIdentifier() && obj.node.name === right.node.name) { + return false; + } return true; };