From d997bf16a77d0489b14f4f09a7660b6f305423df Mon Sep 17 00:00:00 2001 From: Rich-Harris Date: Sat, 31 Oct 2015 21:48:57 -0400 Subject: [PATCH] tidy up --- src/utils/testForSideEffects.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/utils/testForSideEffects.js b/src/utils/testForSideEffects.js index 93d8cb8..12beb3f 100644 --- a/src/utils/testForSideEffects.js +++ b/src/utils/testForSideEffects.js @@ -42,6 +42,14 @@ export default function testForSideEffects ( node, scope, statement, strongDepen const declaration = scope.findDeclaration( node.callee.name ) || statement.module.trace( node.callee.name ); + if ( declaration ) { + if ( declaration.isExternal || declaration.testForSideEffects( strongDependencies ) ) { + hasSideEffect = true; + } + } else if ( !pureFunctions[ node.callee.name ] ) { + hasSideEffect = true; + } + if ( !declaration || declaration.isExternal ) { // we're calling a global or an external function. Assume side-effects hasSideEffect = true;