Browse Source

ignore changes local to a function when determining global side-effects

better-aggressive
Rich-Harris 9 years ago
parent
commit
1dc3669b52
  1. 8
      src/utils/testForSideEffects.js

8
src/utils/testForSideEffects.js

@ -82,10 +82,12 @@ export default function testForSideEffects ( node, scope, statement, strongDepen
let subject = node[ modifierNodes[ node.type ] ];
while ( subject.type === 'MemberExpression' ) subject = subject.object;
const declaration = statement.module.trace( subject.name );
if ( !scope.findDeclaration( subject.name ) ) {
const declaration = statement.module.trace( subject.name );
if ( !declaration || declaration.isExternal || declaration.statement.isIncluded ) {
hasSideEffect = true;
if ( !declaration || declaration.isExternal || declaration.isUsed ) {
hasSideEffect = true;
}
}
}
},

Loading…
Cancel
Save