Browse Source

remove unnecessary reference.isImmediatelyUsed

better-aggressive
Rich-Harris 9 years ago
parent
commit
80ae9fa7a9
  1. 5
      src/Module.js
  2. 5
      src/Statement.js

5
src/Module.js

@ -180,8 +180,11 @@ export default class Module {
if ( statement.node.type !== 'VariableDeclaration' ) return;
const init = statement.node.declarations[0].init;
if ( !init || init.type === 'FunctionExpression' ) return;
statement.references.forEach( reference => {
if ( reference.name === name || !reference.isImmediatelyUsed ) return;
if ( reference.name === name ) return;
const otherDeclaration = this.trace( reference.name );
if ( otherDeclaration ) otherDeclaration.addAlias( declaration );

5
src/Statement.js

@ -133,11 +133,10 @@ export default class Statement {
scope;
const reference = new Reference( node, referenceScope, statement );
references.push( reference );
reference.isImmediatelyUsed = !readDepth;
reference.isReassignment = isReassignment;
references.push( reference );
this.skip(); // don't descend from `foo.bar.baz` into `foo.bar`
}
},

Loading…
Cancel
Save