diff --git a/src/Declaration.js b/src/Declaration.js index 7fb7c86..47b05cb 100644 --- a/src/Declaration.js +++ b/src/Declaration.js @@ -17,7 +17,6 @@ export default class Declaration { this.name = null; this.isReassigned = false; - this.mutations = []; this.aliases = []; } @@ -30,9 +29,6 @@ export default class Declaration { this.name = reference.name; // TODO handle differences of opinion if ( reference.isReassignment ) this.isReassigned = true; - if ( reference.isMutation && !~this.mutations.indexOf( reference.statement ) ) { - this.mutations.push( reference.statement ); - } } hasSideEffect () { @@ -85,7 +81,7 @@ export class SyntheticDefaultDeclaration { if ( this.original ) { return this.original.hasSideEffect(); } - + if ( /FunctionExpression/.test( this.node.declaration.type ) ) { return testForSideEffects( this.node.declaration.body, this.statement.scope, this.statement ); } diff --git a/src/Statement.js b/src/Statement.js index 31b8bd7..1024ca6 100644 --- a/src/Statement.js +++ b/src/Statement.js @@ -112,10 +112,9 @@ export default class Statement { return this.skip(); } - const isMutation = parent && parent.type in modifierNodes; let isReassignment; - if ( isMutation ) { + if ( parent && parent.type in modifierNodes ) { let subject = parent[ modifierNodes[ parent.type ] ]; let depth = 0; @@ -154,7 +153,6 @@ export default class Statement { reference.isImmediatelyUsed = !readDepth; reference.isReassignment = isReassignment; - reference.isMutation = !readDepth && isMutation; this.skip(); // don't descend from `foo.bar.baz` into `foo.bar` }