Browse Source

more tidying up

contingency-plan
Rich-Harris 10 years ago
parent
commit
405bc00a56
  1. 5
      src/Module.js
  2. 2
      src/Statement.js
  3. 8
      src/utils/map-helpers.js

5
src/Module.js

@ -6,7 +6,6 @@ import Statement from './Statement';
import walk from './ast/walk';
import { blank, keys } from './utils/object';
import { first, sequence } from './utils/promise';
import { isImportDeclaration, isExportDeclaration } from './utils/map-helpers';
import getLocation from './utils/getLocation';
import makeLegalIdentifier from './utils/makeLegalIdentifier';
@ -177,8 +176,8 @@ export default class Module {
analyse () {
// discover this module's imports and exports
this.statements.forEach( statement => {
if ( isImportDeclaration( statement ) ) this.addImport( statement );
else if ( isExportDeclaration( statement ) ) this.addExport( statement );
if ( statement.isImportDeclaration ) this.addImport( statement );
else if ( statement.isExportDeclaration ) this.addExport( statement );
statement.analyse();

2
src/Statement.js

@ -24,10 +24,8 @@ export default class Statement {
this.isIncluded = false;
// some facts about this statement...
this.isImportDeclaration = node.type === 'ImportDeclaration';
this.isExportDeclaration = /^Export/.test( node.type );
this.isExportAllDeclaration = /^ExportAll/.test( node.type );
}
analyse () {

8
src/utils/map-helpers.js

@ -9,11 +9,3 @@ export function quoteId ( x ) {
export function req ( x ) {
return `require('${x.id}')`;
}
export function isImportDeclaration ( statement ) {
return statement.isImportDeclaration;
}
export function isExportDeclaration ( statement ) {
return statement.isExportDeclaration;
}

Loading…
Cancel
Save