@ -1,4 +1,5 @@
import Node from '../Node.js' ;
import Node from '../Node.js' ;
import getLocation from '../../utils/getLocation.js' ;
export default class ThisExpression extends Node {
export default class ThisExpression extends Node {
initialise ( scope ) {
initialise ( scope ) {
@ -7,7 +8,9 @@ export default class ThisExpression extends Node {
if ( lexicalBoundary . isModuleScope ) {
if ( lexicalBoundary . isModuleScope ) {
this . alias = this . module . bundle . context ;
this . alias = this . module . bundle . context ;
if ( this . alias === 'undefined' ) {
if ( this . alias === 'undefined' ) {
this . module . bundle . onwarn ( ` The 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten (in ${ this . module . id } ) ` ) ;
const location = getLocation ( this . module . code , this . module . ast . end ) ;
const detail = ` ${ this . module . id } , line: ${ location . line } , column: ${ location . column } ` ;
this . module . bundle . onwarn ( ` The 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten (in ${ detail } ) ` ) ;
}
}
}
}
}
}