|
|
@ -537,6 +537,8 @@ export default class Module { |
|
|
|
// namespace optimisation – name of `foo.bar` could be `bar`
|
|
|
|
if ( reference.name === name && name.length === reference.end - reference.start ) return; |
|
|
|
|
|
|
|
reference.rewritten = true; |
|
|
|
|
|
|
|
// prevent local variables from shadowing renamed references
|
|
|
|
const identifier = name.match( /[^\.]+/ )[0]; |
|
|
|
if ( reference.scope.contains( identifier ) ) { |
|
|
@ -553,7 +555,7 @@ export default class Module { |
|
|
|
|
|
|
|
if ( keys( toDeshadow ).length ) { |
|
|
|
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 ); |
|
|
|
} |
|
|
|
}); |
|
|
|