Skip to content

Commit

Permalink
apply scope refactoring to TaggedTemplateExpression
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed Aug 11, 2017
1 parent 686e907 commit 0e1293d
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/ast/nodes/TaggedTemplateExpression.js
Expand Up @@ -3,9 +3,9 @@ import isProgramLevel from '../utils/isProgramLevel.js';
import callHasEffects from './shared/callHasEffects.js';

export default class TaggedTemplateExpression extends Node {
bind ( scope ) {
bind () {
if ( this.tag.type === 'Identifier' ) {
const declaration = scope.findDeclaration( this.tag.name );
const declaration = this.scope.findDeclaration( this.tag.name );

if ( declaration.isNamespace ) {
this.module.error({
Expand All @@ -23,21 +23,20 @@ export default class TaggedTemplateExpression extends Node {
}
}

super.bind( scope );
super.bind();
}

hasEffects ( scope ) {
return this.quasi.hasEffects(scope) || callHasEffects( scope, this.tag, false );
hasEffects () {
return this.quasi.hasEffects() || callHasEffects( this.scope, this.tag, false );
}

initialise ( scope ) {
initialiseNode () {
if ( isProgramLevel( this ) ) {
this.module.bundle.dependentExpressions.push( this );
}
super.initialise( scope );
}

isUsedByBundle () {
return this.hasEffects( this.findScope() );
return this.hasEffects();
}
}

0 comments on commit 0e1293d

Please sign in to comment.