From 262334d70da1ac5ed9d811e1a20e22d4c9ff7b80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oskar=20Segersv=C3=A4rd?= Date: Wed, 11 Nov 2015 17:54:48 +0100 Subject: [PATCH] Check isUsed to prevent potentially infinite recursion --- src/Module.js | 4 ++++ src/ast/Scope.js | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/Module.js b/src/Module.js index 3bbf32e..be1397d 100644 --- a/src/Module.js +++ b/src/Module.js @@ -17,6 +17,8 @@ class SyntheticDefaultDeclaration { this.original = null; this.isExported = false; this.aliases = []; + + this.isUsed = false; } addAlias ( declaration ) { @@ -42,6 +44,8 @@ class SyntheticDefaultDeclaration { } use () { + if ( this.isUsed ) return; + this.isUsed = true; this.statement.mark(); diff --git a/src/ast/Scope.js b/src/ast/Scope.js index 7a210a4..cf61ba9 100644 --- a/src/ast/Scope.js +++ b/src/ast/Scope.js @@ -40,6 +40,8 @@ class Declaration { this.isReassigned = false; this.aliases = []; + + this.isUsed = false; } addAlias ( declaration ) { @@ -61,6 +63,8 @@ class Declaration { } use () { + if ( this.isUsed ) return; + this.isUsed = true; if ( this.statement ) this.statement.mark();