Browse Source

Simplified Statement.mark by moving reexport special case to analyze

gh-109
Oskar Segersvärd 10 years ago
parent
commit
be15ec33a6
  1. 24
      src/Statement.js

24
src/Statement.js

@ -53,6 +53,19 @@ export default class Statement {
analyse () {
if ( this.isImportDeclaration ) return; // nothing to analyse
// `export { name } from './other'` is a special case
if ( this.isReexportDeclaration ) {
this.node.specifiers && this.node.specifiers.forEach( specifier => {
const id = this.module.exports.lookup( specifier.exported.name );
if ( !~this.dependantIds.indexOf( id ) ) {
this.dependantIds.push( id );
}
});
return;
}
let scope = this.scope;
walk( this.node, {
@ -339,17 +352,6 @@ export default class Statement {
if ( this.isIncluded ) return; // prevent infinite loops
this.isIncluded = true;
// `export { name } from './other'` is a special case
if ( this.isReexportDeclaration ) {
// TODO: If we add the specifiers to `dependantIds`,
// we can remove this special case.
this.node.specifiers.forEach( specifier => {
this.module.exports.lookup( specifier.exported.name ).mark();
});
return;
}
this.dependantIds.forEach( id => id.mark() );
// TODO: perhaps these could also be added?

Loading…
Cancel
Save