Browse Source

Bundle execution is only dependent on program level call expressions

legacy-quote-reserved-properties
Oskar Segersvärd 8 years ago
parent
commit
ab3b38f15a
  1. 15
      src/ast/nodes/CallExpression.js

15
src/ast/nodes/CallExpression.js

@ -30,7 +30,9 @@ export default class CallExpression extends Node {
}
initialise ( scope ) {
this.module.bundle.dependentExpressions.push( this );
if ( isProgramLevel( this ) ) {
this.module.bundle.dependentExpressions.push( this );
}
super.initialise( scope );
}
@ -38,3 +40,14 @@ export default class CallExpression extends Node {
return this.hasEffects( this.findScope() );
}
}
function isProgramLevel ( node ) {
do {
if ( node.type === 'Program' ) {
return true;
}
node = node.parent;
} while ( node && !/Function/.test( node.type ) );
return false;
}

Loading…
Cancel
Save