diff --git a/src/babel/traversal/path/index.js b/src/babel/traversal/path/index.js index 33cd9dfe7b..0fb16c7fa2 100644 --- a/src/babel/traversal/path/index.js +++ b/src/babel/traversal/path/index.js @@ -547,6 +547,9 @@ export default class TraversalPath { var binding = this.scope.getBinding(this.node.name); if (!binding || !binding.constant) return; + // todo: take into consideration infinite recursion #1149 + return; + if (binding.path === this) { return this; } else { diff --git a/test/core/fixtures/transformation/misc/regression-1149/actual.js b/test/core/fixtures/transformation/misc/regression-1149/actual.js new file mode 100644 index 0000000000..a2fe1a1436 --- /dev/null +++ b/test/core/fixtures/transformation/misc/regression-1149/actual.js @@ -0,0 +1,3 @@ +function foo(bar) { + var bar = bar[0]; +} diff --git a/test/core/fixtures/transformation/misc/regression-1149/expected.js b/test/core/fixtures/transformation/misc/regression-1149/expected.js new file mode 100644 index 0000000000..e5a4077240 --- /dev/null +++ b/test/core/fixtures/transformation/misc/regression-1149/expected.js @@ -0,0 +1,5 @@ +"use strict"; + +function foo(bar) { + var bar = bar[0]; +}