Browse Source

tidy up

better-aggressive
Rich-Harris 9 years ago
parent
commit
e3e5846dc5
  1. 4
      src/Declaration.js
  2. 4
      src/Statement.js

4
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 () {

4
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`
}

Loading…
Cancel
Save