|
@ -239,6 +239,12 @@ export default class Statement { |
|
|
const replacementStack = [ names ]; |
|
|
const replacementStack = [ names ]; |
|
|
const nameList = keys( names ); |
|
|
const nameList = keys( names ); |
|
|
|
|
|
|
|
|
|
|
|
let deshadowList = []; |
|
|
|
|
|
nameList.forEach( name => { |
|
|
|
|
|
const replacement = names[ name ]; |
|
|
|
|
|
deshadowList.push( replacement.split( '.' )[0] ); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
if ( nameList.length > 0 ) { |
|
|
if ( nameList.length > 0 ) { |
|
|
walk( this.node, { |
|
|
walk( this.node, { |
|
|
enter ( node, parent ) { |
|
|
enter ( node, parent ) { |
|
@ -248,13 +254,20 @@ export default class Statement { |
|
|
let newNames = {}; |
|
|
let newNames = {}; |
|
|
let hasReplacements; |
|
|
let hasReplacements; |
|
|
|
|
|
|
|
|
nameList.forEach( key => { |
|
|
keys( names ).forEach( key => { |
|
|
if ( !~scope.names.indexOf( key ) ) { |
|
|
if ( !~scope.names.indexOf( key ) ) { |
|
|
newNames[ key ] = names[ key ]; |
|
|
newNames[ key ] = names[ key ]; |
|
|
hasReplacements = true; |
|
|
hasReplacements = true; |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
deshadowList.forEach( name => { |
|
|
|
|
|
if ( ~scope.names.indexOf( name ) ) { |
|
|
|
|
|
newNames[ name ] = name + '$$'; // TODO better mechanism
|
|
|
|
|
|
hasReplacements = true; |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
if ( !hasReplacements ) { |
|
|
if ( !hasReplacements ) { |
|
|
return this.skip(); |
|
|
return this.skip(); |
|
|
} |
|
|
} |
|
|