@@ -32,15 +32,29 @@ module.exports = AbstractPlugin.create({
3232 } ,
3333 "export declaration" : function ( ) { } ,
3434 "export specifier" : function ( statement , id , name ) {
35- var dep = new HarmonyExportSpecifierDependency ( this . state . module , id , name , statement . range [ 1 ] + 0.5 ) ;
35+ var immutable = isImmutableStatement ( statement . declaration ) ;
36+ var hoisted = isHoistedStatement ( statement . declaration ) ;
37+ var dep = new HarmonyExportSpecifierDependency ( this . state . module , id , name , hoisted ? 0 : ( statement . range [ 1 ] + 0.5 ) , immutable ) ;
3638 dep . loc = statement . loc ;
3739 this . state . current . addDependency ( dep ) ;
3840 return true ;
3941 } ,
4042 "export import specifier" : function ( statement , source , id , name ) {
41- var dep = new HarmonyExportImportedSpecifierDependency ( this . state . module , this . state . lastHarmoryImport , HarmonyModulesHelpers . getModuleVar ( this . state , source ) , id , name , statement . range [ 1 ] + 0.5 ) ;
43+ var dep = new HarmonyExportImportedSpecifierDependency ( this . state . module , this . state . lastHarmoryImport , HarmonyModulesHelpers . getModuleVar ( this . state , source ) , id , name , 0 ) ;
4244 dep . loc = statement . loc ;
4345 this . state . current . addDependency ( dep ) ;
4446 return true ;
4547 }
4648} ) ;
49+
50+ function isImmutableStatement ( statement ) {
51+ if ( statement . type === "FunctionDeclaration" ) return true ;
52+ if ( statement . type === "ClassDeclaration" ) return true ;
53+ return false ;
54+ }
55+
56+ function isHoistedStatement ( statement ) {
57+ if ( statement . type === "FunctionDeclaration" ) return true ;
58+ if ( statement . type === "VariableDeclarators" && statement . kind === "var" ) return true ;
59+ return false ;
60+ }
0 commit comments