|
@ -534,6 +534,8 @@ export default class Module { |
|
|
// namespace optimisation – name of `foo.bar` could be `bar`
|
|
|
// namespace optimisation – name of `foo.bar` could be `bar`
|
|
|
if ( reference.name === name && name.length === reference.end - reference.start ) return; |
|
|
if ( reference.name === name && name.length === reference.end - reference.start ) return; |
|
|
|
|
|
|
|
|
|
|
|
reference.rewritten = true; |
|
|
|
|
|
|
|
|
// prevent local variables from shadowing renamed references
|
|
|
// prevent local variables from shadowing renamed references
|
|
|
const identifier = name.match( /[^\.]+/ )[0]; |
|
|
const identifier = name.match( /[^\.]+/ )[0]; |
|
|
if ( reference.scope.contains( identifier ) ) { |
|
|
if ( reference.scope.contains( identifier ) ) { |
|
@ -550,7 +552,7 @@ export default class Module { |
|
|
|
|
|
|
|
|
if ( keys( toDeshadow ).length ) { |
|
|
if ( keys( toDeshadow ).length ) { |
|
|
statement.references.forEach( reference => { |
|
|
statement.references.forEach( reference => { |
|
|
if ( reference.name in toDeshadow ) { |
|
|
if ( !reference.rewritten && reference.name in toDeshadow ) { |
|
|
magicString.overwrite( reference.start, reference.end, toDeshadow[ reference.name ], true ); |
|
|
magicString.overwrite( reference.start, reference.end, toDeshadow[ reference.name ], true ); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|